Print to pdf fails on Windows with multiple pages
Andreas Bergendal
andreas.bergendal at gmail.com
Thu Mar 24 06:06:53 EDT 2022
Hi all,
TL;DR:
App/IDE crashes/fails when printing 30+ pages to single pdf, using Windows 10. Works fine on Mac. Windows memory issues?
Long version:
I have a stack/app where a crucial feature is printing to pdf.
Om Mac (LC 9.6.6 or 9.6.7 rc1) this works flawlessly with 156 posts, resulting in a 312 page pdf file (around 4Mb):
---
set the printScale to 0.714286 ## This matches the A4 proportion of the printed area
set the printMargins to 0,0,0,0
open printing to pdf tFilename ## tFilename has been defined earlier in the process
repeat for each line tLine in pKeyList ## pKeyList is a list of numerical keys
fillFieldsWithData tLine ## This updates several fields on the card with new data from an array
print card 1 from the topLeft of grc "page1" to the bottomRight of grc ”page1” ## An A4-shaped rect
print break
print card 1 from the topLeft of grc "page2" to the bottomRight of grc ”page2” ## An A4-shaped rect
print break
end repeat
close printing ## (I also un/lock screen at appropriate places around this script, for speed)
---
On Windows 10, which is what my client is using, this happens:
- If run in the IDE, it sometimes manages to created the pdf, but usually fails (”printing failed” error), sometimes crashes LC silently
- If run as standalone, it can create a pdf with max 15-20 posts (2x pages), but if I try more then it stalls and fails, or crashes.
Another feature in the app is creating the 156 pdfs individually, and this works flawlessly also on Windows.
So it’s creating the combined pdf that seems too taxing for poor old Windows, most of the time. The client needs both features to work.
Is this ”memory exhaustion” (saw that term mentioned by LCMark in the Forum on a different pdf problem)?
What can be done about it? Can I force Windows to dedicate more memory to my app?
I’ve tried having the pdf created on C:, on a USB stick and in SharePoint (the client’s preferred destination), but all fail equally.
Please advise! :)
Best,
Andreas
More information about the use-livecode
mailing list