PdfSaveOptions - Print As Image?

Hi,

I have a questions related to Aspose.Words.Saving.PdfSaveOptions, is there a way to save in document the property corresponding to File->Print->Advanced->Print As Image option as it exists in Adobe Reader ? For convenience I’m attaching an image containing the location of this option in Adobe Reader.

Thank you,
Aurelian Iordache
IBM Romania

Hi Aurelian,

Thanks for your inquiry. Aspose.Words mimics the same behavior as MS Word does. If you convert your document to Pdf file format by using MS Word, you will get the same output.

The PdfSaveOptions class have not any property for ‘Print As Image option’. In your case, I suggest you following solution.

  1. Convert MS Word document’s pages to images.

In order to save all pages in Microsoft Word document to separate image files, please use the following code snippet. The ImageSaveOptions
class allows to specify additional options when rendering document
pages or shapes to images.

Document document = new Document(@"C:\test\In.docx");

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
options.PageCount = 1;

// Save each page of the document as Png.
for (int i = 0; i < document.PageCount; i++)
{
    options.PageIndex = i;
    document.Save(string.Format(@"C:\test\out_{0}.png", i), options);
}
  1. You can easily convert an Image to PDF format by using the code suggested in the following article:
    https://docs.aspose.com/words/net/convert-a-document-to-pdf/

Please note that you can not directly load an Image file into Aspose.Words DOM (Document Object Model).

Hope this helps you. Please let us know if you have any more queries.