11 Replies Latest reply on Feb 20, 2015 8:56 AM by TSGal

    PDF Rotating Upon Insertion into a Container Field

    jprochniak

      Summary

      PDF Rotating Upon Insertion into a Container Field

      Product

      FileMaker Pro

      Version

      13.0v5

      Operating system version

      OS X 10.10.2

      Description of the issue

      I have an issue when inserting PDFs into a container in that they're rotated either 90 or 180 degrees upon insertion into their respective container field. The settings on the containers are all set identically to "Reduce image to fit" so there seems to be no rhyme or reason to which PDFs rotate.

      To no avail I've tried the following:
      - Copied a container that does not rotate the PDF and replaced the rotating container with the copied one
      - Opened the PDF that rotates, performed a "Save As", and reinserted it

      One more interesting find that I just noticed is that while a PDF may display rotated in its container, when that same document is exported to wherever, it's orientation is correct.


      After one of the community members tested the suspect files they found the following:

      the issue here is that the original is a PORTRAIT document that has been rotated, so that you are 'seeing' it in LANDSCAPE, and assuming that is it is landscape document. This is indeed JUST a flag internally to say to the rendering software, show me this way - same is true incidentally for things like crop boxes, which just limit what you can see, not what is actually In the file.

      What is clearly happening is that FileMaker is ignoring the rotation when it inserts the file into the container, so you get to see it as it was created This is not held in the metadata but is an entry in the PageDictionary, so wheat is happening when you are recreating the file, it is actually writing a new file as a landscape file. I absolutely think this needs reporting. It might be expected behaviour on behalf of the engineers who wrote the software, but it is not expected behaviour from our side. SO report it as a bug, with the file as proof.

      This is really easy to fix fit a tiny bit of code using ScriptMaster with the iText library, as the method you have outlined is really a very nasty workaround. Using direct manipulation on the file takes 11 milliseconds (well thats what I just measured) , and keeps all the content of the file as it was when you found it.

      Please see the following discussion log for the entire discussion on this matter:
      https://community.filemaker.com/message/174977#174977

      Workaround

      To combat this issue I had to perform the following:

      1. I opened the PDF in question and saved it in an alternate format, specifically JPEG.
      2. I opened the newly created JPEG and exported it as a renamed PDF. Here in-lies the key.....you have to rename the newly exported PDF otherwise, for some reason, the the metadata of the problem file does not get overwritten if you simply replace the previous version.
      3. After re-saving and renaming the PDF I was able to drag and drop it into its respective container with the image being oriented correctly.

      As far as the whole matter of making the container interactive....no joy. After making the container interactive I was no longer able simply drag and drop the PDF or insert anything into the respective container for whatever reason.

      I have the two files that may be of interest: the one that gets rotated upon insertion and the one converted to a JPEG and then again to a renamed PDF to combat the rotational issue.

        • 1. Re: PDF Rotating Upon Insertion into a Container Field
          TSGal

          John Prochniak:

          Thank you for your post.

          I would like to get the original PDF and the modified PDF so the testers and I can replicate the issue.  Check your Inbox at the top of this page for instructions where to send the files.

          TSGal
          FileMaker, Inc.

          • 2. Re: PDF Rotating Upon Insertion into a Container Field
            TSGal

            John Prochniak:

            Your files have been received.  Thank you.

            It is not necessary to see your database file as I can see the issue.  Although the Interactive content Container displays the PDF file correctly, the image portion of the file is rotated by 90 degrees.  I have sent your post, file and my findings to our Development and Testing departments for review.  When I receive any feedback, I will let you know.

            TSGal
            FileMaker, Inc.

            • 3. Re: PDF Rotating Upon Insertion into a Container Field
              jprochniak

              Sounds good. Thank you for your time.

              • 4. Re: PDF Rotating Upon Insertion into a Container Field
                philmodjunk

                "the image content of the file" means what exactly? That the file is not correctly displayed until you interact with the PDF in the interactive viewer or that an image on a "page" of the PDF is not correctly rotated?

                • 5. Re: PDF Rotating Upon Insertion into a Container Field
                  jprochniak

                  Sorry for any confusion....what I meant is that the image of the PDF is rotated after insertion into a container despite being correctly oriented when exported and/or viewed outside of the database, i.e. in Reader, Acrobat, etc. Please see the attached partial screenshot. As for the interactive portion, the containers I'm having issues with were designated as images and not interactive. The interactive portion came as a sort of troubleshooting measure to determine if the PDF would react differently in an interactive container versus an image container  which it did not. That being said, once I switched a container to interactive I was no longer able to drag and drop a PDF into that container.

                  I hope this helped clarify things a bit more.

                  John

                   

                  • 6. Re: PDF Rotating Upon Insertion into a Container Field
                    philmodjunk

                    That makes this a "Mac Only" issue as you can't view a PDF as an image in a container field--only in Interactive containers--in the first place.

                    Though an unwelcome limitation, it would make sense that Drag and Drop doesn't work on Interactive Container fields as drag in drop--or so I am told--is the equivalent of selecting Insert Picture, not Insert PDF from the insert menu.

                    But a work around to consider is that you can drag and drop into a non interactive container field and then the OnObjectModify Trigger can be tripped by this action to perform a script that exports a copy to re-insert into an interactive container field using Insert PDF in order to produce a correctly oriented PDF in the field.

                    • 7. Re: PDF Rotating Upon Insertion into a Container Field
                      philmodjunk

                      An entry in the Known Bugs List has been linked to this Issue Report. Any Comments/Questions/Suggested Corrections should be posted here or in a new thread. Please do not post such comments to the Known Bugs List thread.

                      • 8. Re: PDF Rotating Upon Insertion into a Container Field
                        jprochniak

                        I guess I'm confused at this point. I'm able to view PDFs placed into containers without difficulty. The issue still remains that PDFs placed into containers are being rotated for an unknown reason with the only remedy being saving the PDF as an alternate format, re-naming it, and then re-saving it as a separate PDF. The whole interactive container issue was really a sidebar and would seem to be irrelevant as I am not actually utilizing interactive containers on my layout....it was merely a diagnosis tool to see if PDFs would behave differently in an interactive container rather than in an image only container. 

                        • 9. Re: PDF Rotating Upon Insertion into a Container Field
                          jprochniak

                          Merely restating what one developer discovered as the apparent problem:


                          the issue here is that the original is a PORTRAIT document that has been rotated, so that you are 'seeing' it in LANDSCAPE, and assuming that is it is landscape document. This is indeed JUST a flag internally to say to the rendering software, show me this way - same is true incidentally for things like crop boxes, which just limit what you can see, not what is actually In the file.

                          What is clearly happening is that FileMaker is ignoring the rotation when it inserts the file into the container, so you get to see it as it was created This is not held in the metadata but is an entry in the PageDictionary, so wheat is happening when you are recreating the file, it is actually writing a new file as a landscape file. I absolutely think this needs reporting. It might be expected behaviour on behalf of the engineers who wrote the software, but it is not expected behaviour from our side. SO report it as a bug, with the file as proof.

                          This is really easy to fix fit a tiny bit of code using ScriptMaster with the iText library, as the method you have outlined is really a very nasty workaround. Using direct manipulation on the file takes 11 milliseconds (well thats what I just measured) , and keeps all the content of the file as it was when you found it.
                           

                          • 10. Re: PDF Rotating Upon Insertion into a Container Field
                            philmodjunk

                            Yes Mac users can view a PDF inserted as an image. Windows users can't--they must use insert PDF and an interactive container field. I should have been more clear in my last post when I stated that this appears to be a "mac only" issue.

                            • 11. Re: PDF Rotating Upon Insertion into a Container Field
                              TSGal

                              John Prochniak:

                              Our Tester was able to replicate the issue.  Currently, FileMaker Pro only supports rotation for JPEG and TIFF files, so the rotation information saved in the PDF file is not extracted.  Interactive Container uses Preview/Adobe Reader.

                              The information has been sent to Development for review.

                              TSGal
                              FileMaker, Inc.