Skip to content

Instantly share code, notes, and snippets.

Avatar Gists aspose-com-gists

View GitHub Profile
aspose-com-gists /
Last active Jan 26, 2021
Convert Markdown MD file to PDF or Image like PNG, JPG, TIFF
// Load input MD file and Convert Markdown to HTML document
Converter.convertMarkdown(dataDir + "", dataDir + "document.html");
// Convert HTML file to output PDF file format
Converter.convertHTML(dataDir + "document.html", new PdfSaveOptions(), dataDir + "output_md.pdf");
aspose-com-gists / add-image-pdf.cs
Last active Jan 25, 2021
Work with Images in PDF using C#
View add-image-pdf.cs
// For complete examples and data files, please go to
// Open document
Document pdfDocument = new Document("AddImage.pdf");
// Set coordinates
int lowerLeftX = 100;
int lowerLeftY = 100;
int upperRightX = 200;
int upperRightY = 200;
aspose-com-gists / close-streams.cs
Last active Jan 22, 2021
Convert Visio VSD VSDX to PDF using C#
View close-streams.cs
// Close streams
aspose-com-gists / Create-KML-file.cs
Created Jan 21, 2021
Create KML File or Read its Features Programmatically using C#
View Create-KML-file.cs
// Create a layer
using (var layer = Drivers.Kml.CreateLayer(dataDir + "Kml_File_out.kml"))
// Initialize feature for geometry and attributes
layer.Attributes.Add(new FeatureAttribute("string_data", AttributeDataType.String));
layer.Attributes.Add(new FeatureAttribute("int_data", AttributeDataType.Integer));
layer.Attributes.Add(new FeatureAttribute("bool_data", AttributeDataType.Boolean));
layer.Attributes.Add(new FeatureAttribute("float_data", AttributeDataType.Double));
// Set value of different attributes
View excel-to-pdf-compliance.cpp
// 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
aspose-com-gists /
Created Jan 19, 2021
Convert Excel XLSX XLS to CSV or CSV to Excel using Java
// Opening CSV Files
// Creating CSV LoadOptions object
LoadOptions loadOptions = new LoadOptions(FileFormatType.CSV);
// Creating an Workbook object with CSV file path and the loadOptions
// object
Workbook workbook = new Workbook(dataDir + "Book_CSV.csv", loadOptions); + "CSVtoExcel.xlsx" , SaveFormat.XLSX);
aspose-com-gists / ApplyAutofilter.cs
Created Jan 19, 2021
Add or Remove AutoFilter in Excel File (XLSX/XLS) using C#
View ApplyAutofilter.cs
// Instantiating a Workbook object
// Opening the Excel file through the file stream
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(dataDir + "book1.xls");
// Accessing the first worksheet in the Excel file
Aspose.Cells.Worksheet worksheet = workbook.Worksheets[0];
// Creating AutoFilter by giving the cells range of the heading row
worksheet.AutoFilter.Range = "A1:B1";
aspose-com-gists / FormattedTableBuilder.cpp
Created Jan 19, 2021
Add or Insert Table in Word Document (DOC/DOCX) using C++ Programmatically
View FormattedTableBuilder.cpp
System::SharedPtr<Document> doc = System::MakeObject<Document>();
System::SharedPtr<DocumentBuilder> builder = System::MakeObject<DocumentBuilder>(doc);
System::SharedPtr<Table> table = builder->StartTable();
// Make the header row.
// Set the left indent for the table. Table wide formatting must be applied after
// At least one row is present in the table.
aspose-com-gists /
Created Jan 19, 2021
Convert, Export or Render Chart to PDF or Image and pictures like JPG, PNG, BMP, TIFF, SVG, WMP
// Load input XLSX file
Workbook workbook = new Workbook(dataDir + "SampleExcel.xlsx");
for (int sheet = 0 ; sheet < workbook.getWorksheets().getCount() ; sheet++)
// Access required worksheet
Worksheet worksheet = workbook.getWorksheets().get(sheet);
for (int i =0 ; i<worksheet.getCharts().getCount() ; i++)
aspose-com-gists / Convert_PDF_Text_Pure.cs
Created Jan 19, 2021
Convert PDF to TXT or Text to PDF Programmatically using C# VB.NET
View Convert_PDF_Text_Pure.cs
// Open document
Document pdfDocument = new Document(dataDir + "MultiColumnPdf.pdf");
StringBuilder builder = new StringBuilder();
// String to hold extracted text
string extractedText = "";
foreach (Page pdfPage in pdfDocument.Pages)
using (MemoryStream textStream = new MemoryStream())