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

Free Support Forum - aspose.com

PdfFileEditor ResizeContents


I m evaluating the new feature ResizeContents of Aspose PDF PdfFileEditor Class and noted the following:

  • it seems that the Top and Bottom margins are inverted in the final result. I mean if I set the top to i.e. 200pt then the page is resized with the 200pt on the bottom. Is it a bug?
  • If I have a source of more than 1 page, I noted that I must not specify the int array of all pages for the method parameter but passing null instead. By doing that the only 4 initial pages are resized and the rest remains unaltered. Is that caused by the evaluation licence? How to convert all pages at once?
  • If I have a source of 1 page then I must specify the int array as “new [] {1}”. If I pass null as for multipages documents the result is a dirty pdf unreadable in the Acrobat reader. Is it correct?
We already have a licence (Total) for using Aspose PDF older version and we are evaluating to use the new version features.

Can anyone help me? I appreciate any suggestion.

Thank you



Thanks for using our products and sorry for the delayed response.

Can you please share some source PDF files and the code snippet that you are using so that we can test the scenario at our end. We are sorry for your inconvenience.


thank you for answering. Unfortunately I cannot share the PDF. You can easily reproduce the problem by using a PDF created for example for the Letter page size and try to use the PdfFileEditor to resize it for example to A4 with margin:

Top: 0.50 in
Bottom: 0.25 in
Left : 0.25 in
Right: 0.25 in

Note: the method needs points so multiply the inches * 72.

And you will see that the 0.50 margin is placed at the bottom instead of top if you set the margin to the proper property of the ContentsResizeParameters

the method we used is : ResizeContents(Stream source, Stream destination, int[] pages, PdfFileEditor.ContentsResizeParameters parameters);

the parameters is set as

new PdfFileEditor.ContentsResizeParameters(
leftMargin: PdfFileEditor.ContentsResizeValue.Units(leftMargin),
contentsWidth: PdfFileEditor.ContentsResizeValue.Units(contentsWidth),
rightMargin: PdfFileEditor.ContentsResizeValue.Units(rightMargin),
topMargin: PdfFileEditor.ContentsResizeValue.Units(bottomMargin), // BUG: inverted with bottomMargin because of bug in Aspose
contentsHeight: PdfFileEditor.ContentsResizeValue.Units(contentsHeight),
bottomMargin: PdfFileEditor.ContentsResizeValue.Units(topMargin) // BUG: inverted with topMargin because of bug in Aspose

As you can see we had to invert the values to let the method working

The 4 pages is a limit of the evaluation licence. Using the AllowConcatenateExceptions flag you’ll get the exception saying that.

Best Regards



We are working over this query and will get back to you soon. We apologize for this delay and inconvenience.

Hi Vmax,

Thanks for your patience. I’ve observed the swapping of top and bottom parameter values of ResizeContents method and logged it in our issue tracking system as PDFNEWNET-35047 for further investigation and resolution. We will keep you updated regarding issue status via this forum thread.

Moreover, I’m unable to observe null int array issue as in case of null value it doesn’t resize the pages but return original file. And you are right there are two limitations of evaluation version, evaluation watermark and access of four element of any collection.

Please feel free to contact us for any further issue.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-35047) have been fixed in Aspose.Pdf for .NET 8.2.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.