5 Replies Latest reply on Oct 6, 2016 3:33 AM by ktipson

    "Save records as PDF" is acting up


      Dear all,


      I have this weird thing happening. I have a script that is putting a large (IMHO) PDF-report together, based on appx 10 different tables, about 30 records, and above all, in 13 “Parts”. I mean, in the first part, I use the scriptstep “Save records as PDF” and from there on out 12 more times “Save records as PDF + Append to existing PDF”. Some are simple layouts, others are sub-summary reports. The script puts the file on the desktop.


      All went well. With a few appends, and later when the PDF-report needed more parts appended, up to 11 parts. No problems.


      Until I added layout 12 and 13. And now what happens, is that I keep getting an error “xxx.pdf could not be created, use different name etc.” and the file is no good.


      I narrowed the problem down to the script step “Save as PDF” for the 12th layout. But I do not understand what is wrong about that script step, cause I simply copy-pasted it from one of the many earlier in the same script.


      Actions I took to attempt to solve it:

      • Pauzing: If I pause the script right before that step, and I open the PDF, it is still fine, but as soon as this step is executed, the file has blank pages in it and when I close the PDF-reader, it asks me whether I want to save it. Also some times I couldn’t delete it from the desktop...
      • No if-then: The script step is within an if-then routine, but some of the others are as well, and they cause no problems. Also I took it out of the if-then and the problem persisted.
      • Isolation: Simplify the script. Instead of doing 13 layouts, I reduced it to only 2: the fontpage and then, the faulty one. No improvement.
      • 'Even further isolation: Simplify the script even further. I reduced it to only 1 layout, 1 scriptstep, Save records as PDF. No improvement.


      The layout is a sub-summary report, which has two sort-by parts, as are several others that cause no problem. It is 5 pages. It has 5 parts:

      • A leading grand summary (which is like a frontpage to this part. page-break afert 1 occurence is on).
      • Sub-summary when sorted by;
      • Sub-summary when sorted by;
      • Body. (print in 3 columns, across first);
      • Footer.

      It looks fine in Preview mode on the screen.


      The scriptstep goes: Save records as PDF [Restore; "$Path"; Records being browsed]


      I get the feeling that the scriptstep can't be finalised and is "sort of left open". Because without the isolation I get the error. Probably caused by Layout 13 that can't write to a PDF that is still being written to from #12. And when I perform the 'isolated script', there is no error, but when I open the PDF, the layout is missing, and when I try to close it, it asks me whether I want to save...


      Does this in any way sound farmiliar to any of you? And if so, did you find a solution?


      Thanks for the assistance.

      Summer greetings, Thomas.

        • 1. Re: "Save records as PDF" is acting up

          Try deleting the "Save Records as PDF" and recreating it again.  FileMaker and PDFs have many little problems.  You could try a file recovery to see if that helps.  But usually it is an object on the layout.  Can you duplicate the layout and take things out slowly until it works?  Or maybe have it just print one page at a time and see how that works.  Try it on another computer or other platform and see if it has the same problem.  Just some things to try.  Oh, what is the $Path name?  Could it have an illegal character in it?

          • 2. Re: "Save records as PDF" is acting up

            You said the script puts "the file" on the desktop. But the script step you show about doesn't have the Append option selected. Are you trying to create a single file, or multiple files?

            • 3. Re: "Save records as PDF" is acting up

              Thanks Taylor and Mike!


              To start with Mike, You're right. The script step I copied to this post is the one in the destilled "Even further isolation" script. That runs alone, so there is nothing to append to, so I took append out. But in the original script, where the problem started, there is the first 'save records as PDF', that puts the file on the desktop, and then there are 12 instances of the same script step, with the append option ticked. My objective is to generate 1 single PDF-file consisting of 13 layouts, about 40 pages.


              Then Taylor. Thanks for your advice. When I'm back in the office I will do the following:

              • Delete and recreate "Save Records as PDF" scriptstep. (Probably won't do the job, cause it is already copy-pasted from a functionning one. But still, I'll try).
              • Print one page at a time.
              • Investigate the subsummary report Layout to see what could be not okay in it.
              • Dupe the subsummary report Layout and start taking things out bit by bit.


              Pathname is fine. It works on the other 12 layouts and is only created once at the beginning of the script.


              Other computer. Well. It has to work on mine, so even if I got it going on another, it'd still not be solved yet. But if need be I'll try that later.


              The direction to look into is the Layout. That is clear.


              Thanks for that! I'll keep you posted.


              Regards, Thomas.

              • 4. Re: "Save records as PDF" is acting up

                ...Basically what you recommend, is: "Keep at it. Think lineair. Persevere". True , but tough /sweating smiley/.


                I did that. I created a duplicate layout and started testing on that one. It also wasn't working. I took things out, tried, put them back again, tried again etc. for a while. No luck.


                Then I tought I was on to something. The report wasn't right. It should be presenting pictures of 5 sites, 1 site a page. But it actually mixed 2 sites together. One of them has pictures wrongly combined.... And I solved that by sorting by a more unique field. But still the problem was there.


                Finaly I got it working when I took out the picture-container field. Good.


                It wasn't my layout, nor the container field, but the contents of one of them! The question then became, which of the 21 pictures was causing the problem...? Ultimately I took all 21 of them out. I put a couple of home-made .jpg back. Still working!


                It was probably a picture I found on google-images. It had its filename ending in ***.svg.png.


                Solved! Thanks to all. Regards, Thomas.

                • 5. Re: "Save records as PDF" is acting up

                  Hi- I'm having a similar "save as pdf" problem.  Can you clarify what you did to solve the problem?  I'm having this issue on any layout I try to save.