AnsweredAssumed Answered

"Save records as PDF" is acting up

Question asked by tkemmere on Jul 26, 2016
Latest reply on Oct 6, 2016 by ktipson

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.

Outcomes