7 Replies Latest reply: Jan 30, 2014 12:33 AM by Test Screen Name RSS

    page height is zero

    bobhopfner Community Member

      We're building a pre-flight tool to check page orientation and auto-rotate to consistantly build right reading books whether or not the page is landscape or portait but we're coming up with pdfs with MediaBox[0 -612 792 0] and getting page height = 0 and then the tool fails. We don't seem to be able to fix this programmatically. /Rotate = 0. Most of these PDFs are 1.6 but It was noticed that in PDF version 1.6 there is no mediabox and instead just has /BBox. Is there some significance to this? There doesn't seem to be a /Rotate either. I believe these pdfs are created programattically via some API rather than through InDesign or Distiller. We're trying to find a consistent way of determinig page size to do our calculations and/or be able to repair a pdf prior manipulation.

       

      Any ideas how we should go about this? We are using a 3rd party API to do the work but this seems an issue with the actual PDF vs. the API, at least at this point.

       

      thanks,

      Bob

        • 1. Re: page height is zero
          olafdruemmer Community Member

          I can't see the problem...

           

          The MediaBox' lower left corner is at 0 / -692, and the upper right is at 792 / 0 - in other words the page is 792 units wide and 692 units high.

           

          Make sure you never assume that the origin of the MediaBox is at 0 / 0 - it can be anywhere on teh coordinate system.

           

          For example, if you had a MediaBox of

           

          [-20792 -10692 -20000 -10000]

           

          its size would still be 792 by 692.

           

          Olaf

          • 2. Re: page height is zero
            bobhopfner Community Member

            Like I said before it's an orientation problem. I am working with my developer to clarify but the gist is that he can pull in the orientation but that value is inconsistent - doesn't always jive with the page dimensions so that was why he went to look at page size and dimensions where "width being greater than height equals landscape" but apparently that is also inconsistent as page height is zero at times. He's using a pdf library from SyncFusion but he doesn't feel it's an issue with that api, but it could be. We feel like we are looking for a needle in a haystack. Too many unknowns to solve for x.

            • 3. Re: page height is zero
              olafdruemmer Community Member

              But your example does not have a page height of zero... I must be missing something here.

               

              Please make sure you understand the meainign of the values in a MediaBox array correctly: it does not directly contain width or hight, just four values representing the  coordinates of the lower left and upper right corners. The width or height has to be computed by subtracting the appropriate values from each other.

              • 4. Re: page height is zero
                lrosenth Adobe Employee

                In addition to the excellent comments from Olaf - have you opened that PDF up in Adobe Reader (or some other PDF viewer) and seen what the page size is shown there.   Seems to me that the values you are getting back this 3rd party library (that no one has ever heard of!) is incorrect.

                • 5. Re: page height is zero
                  bobhopfner Community Member

                  Thanks, yes, I forgot that point that Acrobat Pro does in fact presesent a page size in either properties or the simple rollover in the corner. It's got to be in there somewhere! So then your statement begs a question: What is a good 3rd party library?

                  thanks!

                  • 6. Re: page height is zero
                    lrosenth Adobe Employee

                    Adobe offers its PDFLibrary for license from Datalogics. Of course that may too much for your needs (which we don't know anything about).

                    • 7. Re: page height is zero
                      Test Screen Name CommunityMVP

                      The page size presented by Acrobat will derived from exactly four fields:

                       

                      MediaBox

                      CropBox

                      Rotate

                      UserUnits

                       

                      You state that some PDFs do not have MediaBox but that would be absolutely wrong. It is always required (the others are optional). It may not be present in the Page object, however, because it may be inherited. Not all libraries will report that.