Skip navigation
Currently Being Moderated

Getting the Aspect Ratio of a pdf.

Oct 13, 2010 4:47 AM

Hi all,

 

I'm using the acrobat activeX control in c#. Is there any way for me to get a) the aspect ratio of the pdf I've opened (be it from the activex control or through other programmable means) and b) the current level of zoom on the document?

 

Alternatively, is there a link anyone could provide to the pdf header format that I can perhaps parse myself.

 
Replies
  • Currently Being Moderated
    Oct 13, 2010 5:36 AM   in reply to HIM_join_me

    PDF files don't have an aspect ratio.

     

    I don't believe there is an API to get the current zoom level.  Check the SDK documentation.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2010 7:23 AM   in reply to HIM_join_me

    Sure, you can ask for the page size (which is in "user units").

     

    Actually, the scaling is based on the view state (fit vs. a specific percentage)

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2010 7:40 AM   in reply to HIM_join_me

    The PDF Standard is ISO 32000-1 and can be downloaded from <http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf>.  There is "simple header", it's a structured file format and you would need to read & parse many aspects of it.

     

    Also, be aware that EACH PAGE in a PDF stands alone - so each one can have its own size, orientation, scale factor, etc.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2010 1:46 PM   in reply to HIM_join_me

    Won't be correct as pages aren't in order and their may be updates and it may all be compressed.

     

    You need to actually write a full parser with filter support and walk the object tree.

     

    Leonard

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points