Hi,
I wonder if it's possible to get for each page the size (e.g. A4 or 297x210) and the margins.
The margins are useful to avoid to print data outside the printer margins
Thanks for the help
G
Page size and margins
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
- John - Tracker Supp
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
- Contact:
Re: Page size and margins
Hi,
there is no way consistent way to extract the page margins I am afraid - technically it could be possible to do so if the file contained this in the 'ArtBox' property - but it is rarely used and will not be in 99% of the files you will have.
With regards the page dimensions - these can be obtained by use of the MediaBox. If the CropBox is set too - get it and intersect with the MediaBox.
See the function : PXCp_PageGetBox etc and also there is an example in the examples folder which should help you get started ..
HTH
there is no way consistent way to extract the page margins I am afraid - technically it could be possible to do so if the file contained this in the 'ArtBox' property - but it is rarely used and will not be in 99% of the files you will have.
With regards the page dimensions - these can be obtained by use of the MediaBox. If the CropBox is set too - get it and intersect with the MediaBox.
See the function : PXCp_PageGetBox etc and also there is an example in the examples folder which should help you get started ..
HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
Re: Page size and margins
Hi!
thanks for the tip .... I tried using:
iPage := 0;
hr := PXCp_PageGetBox( hDocument, iPage, PB_MediaBox, @rect);
but the value returned in rect doesn't match the document size reported by acrobat read. E.g. the PDF is 8,27 x 11,69 in (standard A4) and the rect return 595 x 841,89.
I guess there's something should be translated from pixel to inch ?
Regards
G
thanks for the tip .... I tried using:
iPage := 0;
hr := PXCp_PageGetBox( hDocument, iPage, PB_MediaBox, @rect);
but the value returned in rect doesn't match the document size reported by acrobat read. E.g. the PDF is 8,27 x 11,69 in (standard A4) and the rect return 595 x 841,89.
I guess there's something should be translated from pixel to inch ?
Regards
G
- Lzcat - Tracker Supp
- Site Admin
- Posts: 677
- Joined: Thu Jun 28, 2007 8:42 am
Re: Page size and margins
Hi.
If you want to deal with PDF files in any depth - you will find it extremely beneficial to review the PDF specification (PDFReference), where you can find a lot of helpful information, including an answer to your question
In short - standard unit for PDF dimensions and coordinates is point (pt), which is 1/72 of inch.
The PDF reference is freely available from Adobe's site for all to download and review - as of today's date - this is the correct and current link;
http://www.adobe-direct.com/devnet/pdf/ ... chive.html
HTH.
If you want to deal with PDF files in any depth - you will find it extremely beneficial to review the PDF specification (PDFReference), where you can find a lot of helpful information, including an answer to your question
In short - standard unit for PDF dimensions and coordinates is point (pt), which is 1/72 of inch.
The PDF reference is freely available from Adobe's site for all to download and review - as of today's date - this is the correct and current link;
http://www.adobe-direct.com/devnet/pdf/ ... chive.html
HTH.
Victor
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Re: Page size and margins
Thanks for the useful informations!
best regards
G
best regards
G
- Tracker Supp-Stefan
- Site Admin
- Posts: 17941
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Page size and margins
Our Pleasure G!
Cheers,
Stefan
Cheers,
Stefan