We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PdfZoomBehaviour.FIT_HEIGHT does not work

Hi Team,

I am trying to use this PdfZoomBehaviour feature but seems like it has issues.
FIT_WIDTH works fine but other option in this class does not.

Like FIT_HEIGHT does not set the magnification to fit the height.
The same applies for FIT_BOX & FIT_PAGE.

This can be reproduced with any word to pdf transformation using Latest Aspose.words
Code:

Document doc = new Document(word_file);
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setZoomFactor(PdfZoomBehavior.FIT_HEIGHT);

Thanks,
Satyendra

Hi Satyendra,

Thanks for your inquiry.

PdfSaveOptions.ZoomBehavior Property gets or sets a value determining what type of zoom should be applied when a document is opened with a PDF viewer.

PdfSaveOptions.ZoomFactor Property gets or sets a value determining zoom factor (in percentages) for a document.

Please use setZoomBehavior method instead of setZoomFactor in your code. Please check the following code examples for your kind reference.

Document doc = new Document(MyDir + "ICH_Test_1.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setZoomBehavior(PdfZoomBehavior.ZOOM_FACTOR);
saveOptions.setZoomFactor(50);
doc.save(MyDir + "Out.pdf", saveOptions);
Document doc = new Document(MyDir + "ICH_Test_1.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setZoomBehavior(PdfZoomBehavior.FIT_HEIGHT);
doc.save(MyDir + "Out.pdf", saveOptions);