Print Page | Close Window

PageWidth/PageHeight sometimes problem

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3569
Printed Date: 03 May 24 at 5:53PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: PageWidth/PageHeight sometimes problem
Posted By: HNRSoftware
Subject: PageWidth/PageHeight sometimes problem
Date Posted: 18 May 18 at 4:05PM
This one is driving me crazy.  I have pretty simple code that opens a file, loads a page, sets origin to "1" (Top left), measurementunits to "2" (inches), and and then fetches PageHeight and PageWidth.  It works just fine for "normal" paper pages such as 8.5x11 and 11x8.5.  My problem is an architectural drawing which is 36" wide by 24" tall.  Adobe Acrobat reports it correctly and renders it correctly (as a wide image).  QuickPDF also renders it as a wide image, but "GetPageHeight" and "GetPageWidth" return the wrong values -- they say that the page is 24" wide by 36" tall.

Simplifying out the origin and measurement units doesn't change anything significant. My sequence is: .Create/.UnlockKey/.LoadFromFile/.SelectPage and then use .PageWidth and .PageHeight.

GetPageBox calls return similarly wrong information.

Documentation search does not return anything on "orientation" which is the sort of thing I would expect to control a situation like this.

Anyone have any ideas as to what might be going on?  It is theoretically possible that the file was created oddly, but Acrobat is happy with it and QuickPDF renders it rationally.  I can provide the file as needed.

thanks - Howard

P.S. - when I get this one nailed down, I will go on to weirdness in SetCropBox and the PageBoxes.



Replies:
Posted By: rweetch
Date Posted: 18 May 18 at 8:26PM
Have you checked the page rotation? 

http://www.debenu.com/docs/pdf_library_reference/PageRotation.php 

maybe that might help shed some light on it



Posted By: HNRSoftware
Date Posted: 18 May 18 at 10:29PM
YES! - that was it.  I was so focused on "orientation" that I did not think about "rotation".  That will probably affect my CropBox weirdness as well.  Thank you for pointing me in this direction.  Howard


Posted By: rweetch
Date Posted: 20 May 18 at 12:21AM
I can never remember what the integer values mean so I created a pdf.types file which contains enumerated types for the values I use a lot e.g. TpdfMeasurementUnits = (pmuPoint, pmuMillimetres, pmuInches, pmuPixels). I then have a class helper with proxy properties (in the case MeasurementUnits) and methods which then call the appropriate methods on the underlying DebenuPDF object. 




Posted By: HNRSoftware
Date Posted: 20 May 18 at 12:45AM
I use equivalent logic, but have separate conversion to and from strings so I can avoid having to memorize them.

This rotation question was just the tip of the iceberg on actually working with page boxes (primarily "CropBox").  I don't think I am discovering any actual bugs, but the way it works with rotated pdfs is a trifle weird.  The default origin for QuickPDF is lower right, and I am an old Delphi guy and insist on working with (0,0) as the upper left corner.  I've just tried writing some sentences describing the counter-intuitive nature of working with rectangle heights and widths and file page heights and widths in a page with a 90 degree rotation, and gave up -- X-ish terms cause Y-ish changes -- I may figure out the simple interpretation, but I'm not there yet.

This is fun, in a masochistic way....



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk