5 Replies Latest reply on Mar 15, 2016 5:42 AM by taylorsharpe

    PDF Container Preview existence


      Is there a calculation to test a PDF in a container field to see if the PDF has or does not have a preview?  In other words, I have a database with a lot of PDFs imported by Macs and Windows.  The Mac ones include the PDF and Windows does not.  I would like to be able to test which ones are missing previews so I can run a batch script on a Mac to export and reimport them with the preview.  FYI, I'm happy to use a plugin to solve this and have a number of plugins on this server such as BaseElements and MBS.  Oh, and while I'm asking, does someone know a plugin that can add a preview to a container field without having to use a Mac to export the field contents and reimport them?  Thanks.  

        • 1. Re: PDF Container Preview existence

          I'm not sure about the preview but you don't need the export / import procedure.

          You can use this:


          # get the filename from container

          Set Variable [ $filename ; GetContainerAttribute ( theContainer ; "filename" ) ]

          Set Field [ theContainer ; Base64Decode ( Base64Encode ( theContainer ) ; $filename ) ]


          This will reinsert the container contents ( in memory ) and according to filename extension FileMaker will try and guess what type of document it is and create a preview if possible. I think it's kinda like dragging and dropping the file onto the field.


          So if you can't guess, let it rip through all!




          • 2. Re: PDF Container Preview existence

            And even better, you can get rid of the Set Variable step and put the GetContainerAttribute () within the Set Field.

            It will of course evaluate before the field is set.

            It can be made into a single step or a even a custom function for auto enter calculation.

            cf_Interactive ( Self )


            If you want it behave this way by default that is.

            • 3. Re: PDF Container Preview existence

              Thanks, election.  That sounds quite reasonable and had not thought of it that way (decoding/encoding).  I'll give it a while and your assistance is much appreciated. 

              • 4. Re: PDF Container Preview existence

                Unfortunately, this technique doesn't work.

                - db

                • 5. Re: PDF Container Preview existence

                  I use this technique on solutions with Windows servers because Windows does not give a preview.  So you have to run this decode/encode on a Mac.  In fact what I usually do is have file inserted as a file and not PDF and then test if the SystemPlatform is 1, I then doe this decode/encode for whenever someone is importing a PDF.  What I haven't figured out is what I can do to test which ones don't have previews and which ones do.