Hello,
how can I change the page size of an existing PDF files from e. g. 7x7 inches to a page size with 4x4 inches?
There is no information outside the top/left area with 4x4 inches.
We have a special application for this type of PDF files and therefore it is extremely important that they have the exactly predefined size.
I've already tried to crop the PDF file page by setting the page height and width but then I will loose the information in the top area instead of the area at the bottom.
I seems to be a problem with the originally used coordinate system in the PDF file.
Example with 7x7 (x -> information, _ -> no information):
xxxx___
xxxx___
xxxx___
xxxx___
_______
_______
_______
should be 4x4:
xxxx
xxxx
xxxx
xxxx
What I get after my "cropping" to 4x4:
xxxx___
_______
_______
_______
Kind regards,
vega68
How to crop or change the page size of a existing PDF file
Re: How to crop or change the page size of a existing PDF file
Hello,
I order to achieve this you need to use the SetPageBox method.
Link here:
https://www.gdpicture.com/guides/gdpicture/web ... geBox.html
To get correct PageBox parameters you need to know that PageBox in PDF is always using BottomLeft coordinates.
This means that in your case you just need to make use of GetPageHeight to calculate correct Top and Bottom parameters.
Use following call to set 4x4 inch CropBox on selected page.
I order to achieve this you need to use the SetPageBox method.
Link here:
https://www.gdpicture.com/guides/gdpicture/web ... geBox.html
To get correct PageBox parameters you need to know that PageBox in PDF is always using BottomLeft coordinates.
This means that in your case you just need to make use of GetPageHeight to calculate correct Top and Bottom parameters.
Use following call to set 4x4 inch CropBox on selected page.
Code: Select all
status = oGdPicturePDF.SetPageBox(PdfPageBox.PdfPageBoxCropBox, 0, oGdPicturePDF.GetPageHeight(), 4, oGdPicturePDF.GetPageHeight()-4);
Who is online
Users browsing this forum: No registered users and 1 guest