/// <summary>
/// Converts DOCX document to a PDF document using ImageCollection and PdfEncoder classes.
/// </summary>
public static void ConvertDocxToPdf(string docxFileName, string pdfFileName)
{
// specify that VintaSoft Imaging .NET SDK should use GDI+ for drawing of 2D graphics
Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsFactory.SetAsDefault();
// specify that VintaSoft Imaging .NET SDK should use SkiaSharp for drawing of 2D graphics
//Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();
// create image collection
using (Vintasoft.Imaging.ImageCollection imageCollection = new Vintasoft.Imaging.ImageCollection())
{
// add DOCX document to collection
imageCollection.Add(docxFileName);
// create pdfEncoder
using (Vintasoft.Imaging.Codecs.Encoders.PdfEncoder pdfEncoder =
new Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(true))
{
// set comression for image resources
pdfEncoder.Settings.Compression = Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Jpeg;
// save images of image collection to PDF document using PdfEncoder
imageCollection.SaveSync(pdfFileName, pdfEncoder);
}
// dispose images
imageCollection.ClearAndDisposeItems();
}
}
Forum 'VintaSoft Office .NET Plug-in Discussions'
Questions, comments and suggestions concerning VintaSoft Office .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft Office .NET Plug-in Discussions
