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

Free Support Forum - aspose.com

Problem with addMargins method in com.aspose.pdf.facades.PdfFileEditor Class


The addMargins method in com.aspose.pdf.facades.PdfFileEditor Class is defined as below as per Aspose JAVA Doc:

addMargins(InputStream source,OutputStream destination,int[] pages, double leftMargin, double rightMargin, double topMargin,double bottomMargin)

It seems to me that value given for topMargin is actually being used for bottomMargin and vice-versa. I noticed during one of my example program. You too can write a small example program and test it.

Could you please check this issue?


Sumit Jha

CVS Health

Hi Sumit,

Thanks for your inquiry. I have tested the scenario with Aspose.Pdf for Java 11.3.0 and unable to notice the issue. Please download and try latest version of Aspose.Pdf for Java, hopefully it will resolve the issue. However if the issue persist then please share your sample PDF document and code here, we will look into it and guide you accordingly.

PdfFileEditor fileEditor = new PdfFileEditor();<o:p></o:p>

FileInputStream src=new FileInputStream(myDir + "DemoTest.pdf");

FileOutputStream dest = new FileOutputStream(myDir+"margin_output.pdf");

fileEditor.addMargins(src, dest,

//process pages 1, 2, 3

new int[] { 1 },

//left margin is 10 units


//right margin is 5 units


//top margin is 5 units


//bottom margin is 5 units



We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,

The problem I reported was using aspose.pdf-11.1.0.jar (as last time when I downloaded this version was available in late January 2016).

I tried today with aspose.pdf-11.3.0.jar and it is working fine as you said to download new version.

Please let me know how often you release the new version of JAR?

Sumit Jha
CVS Health

Hi Sumit,

Thanks for your feedback. It is good to know that you have managed to resolve the issue.

We release new version of Aspose.Pdf for Java on monthly basis, generally in start of the month. Furthermore, Please note we maintain a single code base of our APIs. All fixes and enhancements are made in latest version, so we can not provide hotfix for older versions.

Best Regards,