-------------- Original message ----------------------
From: "Slavin, Andrew" <[EMAIL PROTECTED]>
>
> hi,
> 
> i've been using PdfReader.GetPageSizeWithRotation method to determine
> the height and width of pages in pdf documents for quite a while now,
> and it's always been working as i expect, but now i got this document
> where it does not. when i call the GetPageSizeWithRotation method on the
> first page and then convert the obtained rectangle size from points to
> millimeters, i get 297 x 210 mm - exactly the A4 size. when i open the
> document in acrobat 7 though and select File -> Document Properties, it
> tells me that the page size is 274.5 x 189.4 mm which is smaller than
> A4.
> 
> can someone please explain this behaviour? is there a way to
> programmatically get the size shown by acrobat reader?

Please post a code fragment that replicates the behavior your seeing.

Paulo has suggested you look at the Crop Box coordinates, which is good advice. 
I suspect you'll find that the lower-left-hand corner (llc) of your PDF is not 
at (0, 0) in PDF document space.

FYI, some of the iText convenience methods for width and height are based on 
the llc being a (0, 0). If the llc is elsewhere, you'd do better by using the 
methods that return results that are consistent with your situation, e.g., from 
actual working code:

                //mods for shifted origin, 3Oct2007
                float llx, lly, urx, ury;
                llx = SFx*pageSize.left();
                lly = SFy*pageSize.bottom();
                urx = SFx*pageSize.right();
                ury = SFy*pageSize.top();

Now, without seeing your code, or the PDF with which you're having problems, or 
knowing the version of Reader you're using, I'm just gueswsing the problem 
you're having might be similar to the problem I experienced for which the above 
methods provided a correct solution.

Please let us know if you need more, providing the aformentioned missing 
information, if this response doesn't help you solve your problem.

BTW, the above information is definitely findable in the documentation and 
examples.

Do you have the book? If not, it's highly recommended, if you're serious about 
working with iText.

Best regards,
Bill Segraves


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to