Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created January 20, 2021 02:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aspose-com-gists/71ff4dee6a600bbec6ec5ac2e3800ea0 to your computer and use it in GitHub Desktop.
// Source directory path.
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\");
// Output directory path.
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\");
// Path of input Excel file
StringPtr sampleConvertExcelWorkbookToPDF = srcDir->StringAppend(new String("sampleConvertExcelWorkbookToPDF.xlsx"));
// Path of output Pdf file
StringPtr outputConvertExcelWorkbookToPDF = outDir->StringAppend(new String("outputConvertExcelWorkbookToPDF_DirectConversion.pdf"));
// Load the sample Excel file.
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(sampleConvertExcelWorkbookToPDF);
// Create pdf save options object.
intrusive_ptr<Aspose::Cells::IPdfSaveOptions> pdfSaveOptions = Factory::CreateIPdfSaveOptions();
// Set the compliance to PDF/A-1b.
pdfSaveOptions->SetCompliance(Aspose::Cells::Rendering::PdfCompliance_PdfA1b);
// Save the Excel Document in PDF format
workbook->Save(outputConvertExcelWorkbookToPDF, pdfSaveOptions);
// Source directory path.
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\");
// Output directory path.
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\");
// Path of input Excel file
StringPtr sampleConvertExcelWorkbookToPDF = srcDir->StringAppend(new String("sampleConvertExcelWorkbookToPDF.xlsx"));
// Path of output Pdf file
StringPtr outputConvertExcelWorkbookToPDF = outDir->StringAppend(new String("outputConvertExcelWorkbookToPDF_DirectConversion.pdf"));
// Load the sample Excel file.
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(sampleConvertExcelWorkbookToPDF);
// Create pdf save options object.
intrusive_ptr<Aspose::Cells::IPdfSaveOptions> pdfSaveOptions = Factory::CreateIPdfSaveOptions();
// Set the compliance to PDF/A-1b.
pdfSaveOptions->SetCreatedTime(new Aspose::Cells::Systems::DateTime(2017, 5, 25));
// Save the Excel Document in PDF format
workbook->Save(outputConvertExcelWorkbookToPDF, pdfSaveOptions);
// Source directory path.
StringPtr srcDir = new String("..\\Data\\01_SourceDirectory\\");
// Output directory path.
StringPtr outDir = new String("..\\Data\\02_OutputDirectory\\");
// Path of input Excel file
StringPtr sampleConvertExcelWorkbookToPDF = srcDir->StringAppend(new String("sampleConvertExcelWorkbookToPDF.xlsx"));
// Path of output Pdf file
StringPtr outputConvertExcelWorkbookToPDF = outDir->StringAppend(new String("outputConvertExcelWorkbookToPDF_DirectConversion.pdf"));
// Load the sample Excel file.
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(sampleConvertExcelWorkbookToPDF);
// Save the Excel Document in PDF format
workbook->Save(outputConvertExcelWorkbookToPDF, SaveFormat_Pdf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment