Print same card multiple times to single pdf - possible?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 266
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Print same card multiple times to single pdf - possible?

Post by SWEdeAndy » Mon Jan 10, 2022 5:54 pm

I have a stack with one card, multiple fields and other stuff. I want to print the card to a pdf, reusing the same card but populating it with new data each time. So I want card 1 to be printed e.g. 10 times, with different data each time, to one single pdf with 10 pages.

In pseudo-code, I've tried this:

Code: Select all

open printing to pdf "myfile.pdf"

repeat x times
   updateCard1Data
   print card 1
end repeat

close printing
The result is a pdf file with only the last data update on a single page. So it doesn't work.

Now, is there a way to make it work, WITHOUT having to create and populate as many cards as there will be pages in the pdf?
Or is printing to pdf restricted to 'one card - one page'?
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
WhenInSpace: https://wheninspace.se/en

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

Re: Print same card multiple times to single pdf - possible?

Post by andresdt » Mon Jan 10, 2022 6:08 pm

try putting "print break" this will create a new page in your PDF

Code: Select all

open printing to pdf "myfile.pdf"

repeat x times
   updateCard1Data
   print card 1
   print break
end repeat

close printing

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 266
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Print same card multiple times to single pdf - possible? [SOLVED]

Post by SWEdeAndy » Mon Jan 10, 2022 6:16 pm

andresdt wrote:
Mon Jan 10, 2022 6:08 pm
try putting "print break" this will create a new page in your PDF
YES!!! That did it! You are a genius! Thanks!!!

Wow, I post a problem and 14 minutes later it's solved! I love this forum! And LiveCode! And andresdt! :D
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
WhenInSpace: https://wheninspace.se/en

Post Reply

Return to “Talking LiveCode”