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

Free Support Forum - aspose.com

Aspose PDF : Remove white spaces from pdf

We have a requirement in which we need to add files generated from tex files
We integrate these pages in main document.
The problem is there are lots of white spaces or empty area at the end of each page.
Is there any way we can find and delete the extra white spaces at the end of the page.
Please reply at your earlies

@PriyankaShelke

Thanks for contacting support.

You may please use code snippet given in following article of API documentation to remove/trim white space around a PDF page using Aspose.PDF.

In case of further assistance, please feel free to let us know.

Hi,

I have seen the code, it is removing the white spaces but the page size is shortened. I want the pages to be as other pages in document.
The white space below the content of each page should be removed(I am not talking about bottom margins). I merge multiple pdf files and the last page of each pdf file has empty space which is the area I want to remove and take the content from next pdf file

@PriyankaShelke

Thanks for writing back.

Would you kindly share sample PDF document along with an expected output which you desire to generate. We will test the scenario in our environment and address it accordingly.

TrimWhiteSpace.JPG (43.7 KB)
PdfwithTrimPage.png (22.7 KB)

Please observe attachent “TrimWhiteSpace”, The white space at the end of 1st page(marked with blue rectangle) should be removed and the text which is present in 2nd page should be moved up to bottom of 1st page. The 2nd page should be removed.

With the code you provided I got the output as seen in “PdfwithTrimPage” . The 1st page is cropped. which is not what is expected. The pdf view is also very wierd if the pages are not of consistent size.

@PriyankaShelke

Thanks for sharing more details and screenshot.

As requested earlier, would you please share your sample PDF document with us. We will try to implement what you require and share our findings with you.