Does Aspose.Words saves DOCX to PDF without compressing the images using C#

Hello, for compliance reasons with the FDA, we need to ensure that the PDF conversion from Word to PDF using Aspose does not result in loss of data. In other words, we need to provide lossless compression of images.

To accomplish that, we are assuming that we need to use the PdfSaveOptions.ImageCompression property (of type PdfImageCompression). Is that the right property to use? If so, do we need to set it to “Auto” or to “Jpeg” with a JpegQuality of 100?

If this is not the property to use, how can we convert a Word to PDF with lossless compression of images?

Thank you for your support!

@guillaume.gerard,

Thanks for your inquiry. The default value of PdfSaveOptions.ImageCompression is Auto. In your case, you do not need to use this property. Please note that Aspose.Words mimics the behavior of MS Word. Its mean that if you convert your document to PDF using MS Word, you will get the same output.

Thanks Tahir. Just to make sure I understood: are the images compressed or not compressed when converting a Word to PDF with Aspose?

@guillaume.gerard,

Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. Aspose.Words automatically selects the most appropriate compression for each image when document is converted to PDF.

Could you please share complete detail of your use case and requirement? We will then log it as feature request in our issue tracking system.

Our requirement is pretty simple: We need to be able to convert a word to PDF without compressing the images.How can we do it?

@guillaume.gerard,

Thanks for sharing the detail. We have logged this feature request as WORDSNET-17117 in our issue tracking system. You will be notified via this forum thread once this feature is available.

Could you please share your input Word document and expected output PDF here for our reference? Thanks for your cooperation.

@guillaume.gerard,

Thanks for your patience. You can achieve your requirement using following code example.

Document doc = new Document(MyDir + "input.docx");

PdfSaveOptions options = new PdfSaveOptions();
options.ImageCompression = PdfImageCompression.Auto;
options.JpegQuality = 100;

doc.Save(MyDir + "18.7.pdf", options);

Great! Thanks for the feedback.

One more question please.

What are the default values for ImageCompression and JpegQuality? If those parameters are not set in our code, are the default values “Auto” and “100” respectively? In that case, please confirm that we don’t need to change anything to comply with our requirement.

@guillaume.gerard,

Thanks for your inquiry. The default value of ImageCompression is “Auto” and JpegQuality is “100”. You can use following code example to achieve your requirement.

Document doc = new Document(MyDir + "input.docx");
doc.Save(MyDir + "18.7.pdf");

A post was split to a new topic: Convert word to PDF without compressing the images