IOS Print to PDF

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: IOS Print to PDF

Post by Nakia » Thu Jan 31, 2013 7:52 am

Hi Jacque,

tCardsToPrint is built from below, and the 2 values are the names of the Cards.

Code: Select all

put ("Print" & return & "Print2" & return) into tCardsToPrint
I will try the empty handler and place the cards back into the main stack

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: IOS Print to PDF

Post by Nakia » Thu Jan 31, 2013 8:00 am

Tried the empty handler in each print card (after putting them into the Mainstack) but still the same result.
FYI, printing loop worked again fine....

Any other suggestions?

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

Re: IOS Print to PDF

Post by jacque » Thu Jan 31, 2013 8:02 pm

You could lock messages instead, which prevents engine messages from occuring:

Code: Select all

on printPDF
  lock messages
  -- etc
  unlock messages
end printPDF
I'm not sure why printing doesn't print all pages. The best way for you to find out is to set a debugging checkpoint and trace each line. Or add a check for "the result" after the print command, there may be an error in it.

Code: Select all

print card (line x of tCardsToPrint) of stack "Printing" into 110,50,500,700
if the result is not empty then answer the result
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: IOS Print to PDF

Post by Nakia » Thu Jan 31, 2013 10:38 pm

Hi Jacque,

Tried the lock message commad on the start of the handler but no luck unfortunately.
still seeing the same thing..

I will try getting it back into a Substack and debug this print loop..

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: IOS Print to PDF

Post by Nakia » Fri Feb 01, 2013 12:42 am

Okay,

So after adding the dubugging point in the print loop and seeing nothing I thought I might run it in the IDE and see what happened.
When it gets to printing the card it errors out and says:
"card or stack must be open to print it"

So i added -- openStack "Printing" to the start of the handler but it shows the stack even with the lock screen set..

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: IOS Print to PDF

Post by Nakia » Fri Feb 01, 2013 1:38 am

Success :D

- Set Invisibility to false of the sub Stack
- open and close the stack when printing

Code: Select all

on printPDF
   -- PDF Printing
   put specialFolderPath("documents") & "/Inspection.pdf" into tFilePath
   put ("Print" & return & "Print2" & return) into tCardsToPrint
   lock screen
   open stack "Printing"
   open printing to pdf tFilePath
   if the result is "Cancel" then exit printPDF
   repeat with x = 1 to the number of lines of tCardsToPrint
      print card (line x of tCardsToPrint) of stack "Printing" into 110,50,500,700
      print break
   end repeat
   close printing
   close stack "Printing"
   wait 2 seconds
   unlock screen
   mergReader tFilePath
   
end printPDF

Thanks everyone for all their help!!!!

Post Reply