Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
conholdate-gists / compress-word-documents.cs
Created April 16, 2024 21:27
Compress Word Documents in C# | DOC DOCX Compressor
// Load input Word document
Aspose.Words.Document doc = new Aspose.Words.Document("input.docx");
// Create an object of OoxmlSaveOptions class
Aspose.Words.Saving.OoxmlSaveOptions saveOptions = new Aspose.Words.Saving.OoxmlSaveOptions(Aspose.Words.SaveFormat.Docx);
// Use Super Fast compression level for faster and weaker compression
saveOptions.CompressionLevel = Aspose.Words.Saving.CompressionLevel.SuperFast;
// Save compressed Word DOCX document
@conholdate-gists
conholdate-gists / convert-fbx-to-obj.cs
Created April 15, 2024 20:53
Convert FBX to OBJ Online for Free | FBX to OBJ in C# or Java
string inputFile ="file.fbx";
using (Image image = Image.Load(inputFile))
{
// Initialize ObjOptions class object
ObjOptions options = new ObjOptions();
// Export FBX to OBJ
string outPath = "output.obj";
image.Save(outPath, options);
}
@conholdate-gists
conholdate-gists / convert-pdf-to-mobi-xml.java
Created March 27, 2024 00:50
Convert PDF to XML in Java | PDF to XML Converter
// Load PDF document
Document document = new Document("input.pdf");
// Convert PDF to XML format
document.save("output.xml", com.aspose.pdf.SaveFormat.MobiXml);
@conholdate-gists
conholdate-gists / convert-excel-to-json-advanced.cs
Created March 22, 2024 09:59
Convert Excel XLSX XLS to JSON in C# .NET
// Load Excel file
Workbook wb = new Workbook("Workbook.xlsx");
// Create JsonSaveOptions class object
Aspose.Cells.JsonSaveOptions options = new Aspose.Cells.JsonSaveOptions();
options.SkipEmptyRows = true;
options.ExportAsString = true;
// Save as JSON
wb.Save("Excel_to_JSON.json", options);
@conholdate-gists
conholdate-gists / convert-3mf-to-stl.cs
Created March 20, 2024 09:18
Convert 3MF to STL File Online for Free - Create 3MF to STL Converter in C# or Java
// Load the input 3MF file
var scene = Aspose.ThreeD.Scene.FromFile("cylinder.3mf");
// Create an object of StlSaveOptions class
Aspose.ThreeD.Formats.StlSaveOptions options = new Aspose.ThreeD.Formats.StlSaveOptions();
// Convert 3MF to STL
scene.Save("3MFtoSTL.stl", options);
@conholdate-gists
conholdate-gists / Convert-DOCX-to-PPTX.java
Created March 18, 2024 20:01
Convert DOCX to PPTX in Java | Word DOC DOCX Document to Presentation Converter
// Load the source DOCX file
com.groupdocs.conversion.Converter converter = new com.groupdocs.conversion.Converter("sample.docx");
// Create an object of PresentationConvertOptions class
com.groupdocs.conversion.options.convert.PresentationConvertOptions options = new com.groupdocs.conversion.options.convert.PresentationConvertOptions();
// Convert Word DOCX to PPTX Presentation
converter.convert("Presentation.pptx", options);
@conholdate-gists
conholdate-gists / Convert-HTML-to-PPTX.java
Created March 14, 2024 12:31
Convert HTML to PPTX Presentation Slides in Java
// Initialize an HTML document from the file
var document = new com.aspose.html.HTMLDocument("spring.html");
// Initialize PdfSaveOptions
var options = new com.aspose.html.saving.PdfSaveOptions();
// Convert HTML to PDF
com.aspose.html.converters.Converter.convertHTML(document, options, "spring-output.pdf");
// Load PDF document
@conholdate-gists
conholdate-gists / convert-xml-to-pdf.cs
Created March 8, 2024 11:51
Convert XML to PDF in C# .NET
// Instantiate Document object
Document doc = new Document();
// Bind source XML file
doc.BindXml(dataDir + "input.xml");
// Convert XML to PDF
doc.Save(dataDir + "XMLToPDF.pdf");
@conholdate-gists
conholdate-gists / convert-pdf-to-mobi-xml.cs
Created March 5, 2024 20:59
Convert PDF to XML in C# | PDF to XML Converter in .NET
// Load PDF document
Document document = new Document("input.pdf");
// Convert PDF to XML format
document.Save("output.xml", Aspose.Pdf.SaveFormat.MobiXml);
@conholdate-gists
conholdate-gists / convert-word-docx-to-jpg-image.cs
Created March 1, 2024 14:03
Convert Word Document DOC DOCX to JPG PNG Image in C# .NET
// Load the input Word document
Aspose.Words.Document doc = new Aspose.Words.Document("Words.docx");
// Initialize an object of ImageSaveOptions class
Aspose.Words.Saving.ImageSaveOptions options = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Jpeg);
// Set the "PageSet" to "0" to convert only the first page of a document.
options.PageSet = new Aspose.Words.Saving.PageSet(0);
// Set the image's brightness and contrast.