Skip to content

Instantly share code, notes, and snippets.

@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.
@conholdate-gists
conholdate-gists / Compress-CSV.cs
Created February 27, 2024 20:50
Compress CSV Online Free | Reduce File Size with CSV Compressor in C#
// Create Archive class object
var arch = new Archive();
// Specify file names and create entry
arch.CreateEntry(dataDir + "input.csv", dataDir + "Sample.csv");
// Save compressed ZIP archive containing CSV data
arch.Save(dataDir + "csv_archive.zip");
@conholdate-gists
conholdate-gists / Convert-RGB-to-CMYK.cs
Created February 22, 2024 21:40
Convert RGB to CMYK Color Space Online | C# RGB to CMYK Converter
// Parse RGB color
Aspose.Svg.Drawing.Color rgb = Aspose.Svg.Drawing.Color.FromRgb(150, 121, 199);
// Convert RGB to CMYK
var cmyk = rgb.Convert(Aspose.Svg.Drawing.ColorModel.Cmyk);
// Print the CMYK color
Console.WriteLine("CMYK: " + cmyk.ToString());
@conholdate-gists
conholdate-gists / DWG-to-PDF-advanced.java
Created February 20, 2024 22:38
Convert DWG to PDF in Java | CAD to PDF Converter in Java
// Load input DWG drawing
com.aspose.cad.Image image = com.aspose.cad.Image.load("sample.dwg");
// Create an instance of PdfOptions
com.aspose.cad.imageoptions.PdfOptions pdfOptions = new com.aspose.cad.imageoptions.PdfOptions();
// Create an instance of CadRasterizationOptions and set its various properties
com.aspose.cad.imageoptions.CadRasterizationOptions rasterizationOptions = new com.aspose.cad.imageoptions.CadRasterizationOptions();
@conholdate-gists
conholdate-gists / Convert-HTML-to-JPG-image.cs
Created February 15, 2024 22:13
Convert HTML to Image in C# | HTML Webpage to JPG JPEG PNG Picture Photo
// Initialize an HTML document from the file
using var document = new Aspose.Html.HTMLDocument("spring.html");
// Initialize ImageSaveOptions
var options = new Aspose.Html.Saving.ImageSaveOptions(Aspose.Html.Rendering.Image.ImageFormat.Jpeg);
// Convert HTML to JPG
Aspose.Html.Converters.Converter.ConvertHTML(document, options, "spring-output.jpg");
@conholdate-gists
conholdate-gists / Word-DOCX-Viewer.cs
Created February 14, 2024 10:15
Free Word Document Viewer Online | Open and View Word DOCX DOC
// Instantiate viewer
using (Viewer viewer = new Viewer("resume.docx"))
{
// Set output HTML options
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources();
// Render DOCX to HTML with embedded resources
viewer.View(options);
}