Printing Text Longer than One Page

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Printing Text Longer than One Page

Post by hrcap » Sun Apr 19, 2020 1:19 pm

Hi All

I hope that everyone is well.

I am starting my first attempt at printing reports to PDF.

I can get a one page report to print to PDF and save to desktop.

If the text requiring printing is longer than 1 page long Is it possible to print the text as multiple pages?

The method I am currently using prints the text that fits onto page 1 and then cuts off the rest.


Many Thanks

Hadleigh

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Printing Text Longer than One Page

Post by Klaus » Sun Apr 19, 2020 3:46 pm

Hi Hadleigh,

please look up "revprintfield" in the dictionary, maybe that is what you are looking for.


Best

Klaus

hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Re: Printing Text Longer than One Page

Post by hrcap » Sun Apr 19, 2020 6:03 pm

Excellent, thank you very much Klaus

I have just carried out a small trial and it looks like revprintfield will likely be the answer to the issue after some practice.


Many Thanks

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Printing Text Longer than One Page

Post by dunbarx » Sun Apr 19, 2020 6:27 pm

Hi.

I will check my code tomorrow at my office, since it has been a long time since I saw the snippet that does it, but I print multiple pages "to PDF" all the time. I do not remember ever using "revPrintField" in my process.

Craig

hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Re: Printing Text Longer than One Page

Post by hrcap » Sun Apr 19, 2020 6:29 pm

Lovely thanks Craig,

I look forward to seeing your method also.


Many thanks

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Printing Text Longer than One Page

Post by dunbarx » Mon Apr 20, 2020 6:33 pm

Hi.

I always find it odd how I always have to review my old code to even remember how I implemented whatever I did.

So not rocket science:

Code: Select all

...
open printing to pdf (filepath & ".pdf") ---SAVE DRAWING TO LOCATION WITH ".PDF" EXTENSION
   repeat numPages   --I know in advance the length of the nascent document. This may be a sticking point for you
 -- Lots of populating cards with text, and adjusting the physical dimensions of many graphics
 --The result is a series of CAD-like drawings, the best LC can do
      print this card
   end repeat
   close printing
   ...
   
So old stuff, that is, print successive cards. This may be entirely different than your issue of printing run-away text. But on the other hand, a little pre-processing ought to give you the same essential I have, the number of pages in the final, and them maybe you can sort of do what I did.

Anyway, let us know...

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Printing Text Longer than One Page

Post by jacque » Tue Apr 21, 2020 5:47 pm

The pageHeights function will give you the number of pages to print.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Re: Printing Text Longer than One Page

Post by hrcap » Tue Apr 21, 2020 7:46 pm

Thanks Jacque and Craig

Craig I understand your method but it won't quite work for my purpose as I will be printing a list of records and the number of lines of text in each record won't be the same.

I have spent all day working on a script which dynamically builds the print layout for each page and populates the text fields of each record. The script also counts the number of lines of text for each record and using the line height works out if the text can fit into the remaining space on the page, if it can't then it will fit in as many lines of the text onto the page as possible and save the remaining lines into a 'text remaining' field. A new page will then be started and the first row of the new page will be populated with the text remaining.

A work in progress, and a lot of work but it will hopefully be a template that I can work from for future similar reports.


Many Thanks

Post Reply