Page 1 of 1

how can I print a card from iPad?

Posted: Thu Jun 13, 2013 7:12 am
by OzSanta
G'day coders

I've got a project that's working fine on mac OS, but am trying to get it to work on iOS (iPad). Everything's OK except for printing on the simulator. Before I pay to enable it to be run on an actual iPad, I have two questions.

1. Can a PDF be created of a given card, and sent by email?

2. Can a hard copy be printed?

and of course, how?

Regards

Santa

Re: how can I print a card from iPad?

Posted: Fri Jun 14, 2013 3:06 am
by OzSanta
G'day

I've found the mergExt site, and purchased the mergDoc extension. However, I have some questions about it. I can't yet test it's output, as I'm only running on the simulator, but...

1. How can I change the output PDF's from the name 'test.pdf'.

2. Is my code below correct? (the included example is very, very difficult to understand for a newbie)

3. I want to automatically add a second 'contract' pdf to the email body. Can this be done?

Regards

Santa

Code: Select all

on  goPrint test
   local tPDFFile
   if test = empty then put false into test
   if the platform = "iPhone" then
      if test = true  then
         answer question "Do you want to Print this card, or email it." with "Print" or "eMail" or "Cancel" 
         if it = "Cancel " then exit goPrint
         put it into thetest 
      else
         put "Print" into theTest
      end if
   end if
   lock screen for visual effect
   put the colors of this stack into tempcolors
   set the backgroundcolor of this stack to "255,255,255"
   put the printPaperRectangle into tRectangle
   put item 1 of tRectangle +20 into item 1 of tRectangle
   put item 2 of tRectangle +20 into item 2 of tRectangle
   put item 3 of tRectangle - 20 into item 3 of tRectangle
   put item 4 of tRectangle - 20 into item 4 of tRectangle
   unlock screen with visual effect dissolve 
   if the platform = "MacOS" then
      answer printer
      if  the result is not "Cancel" then 
         set formatForPrinting of this stack to true
         print this card into tRectangle
         set formatForPrinting of this stack to false 
      end if
   end if
   if the platform = "iPhone" and theTest = "Print" then
      put specialFolderPath("Documents") & slash & "test.pdf" into tPDFFile
      delete file tPDFFile
      open printing to pdf tPDFFile
      print this card into tRectangle
      close printing
      rreHardcopyPrintPDF tPDFFile, "Test PDF Print"
      if the result is not "OK" then answer "Print PDF returned" && the result
   end if
   if the platform = "iPhone" and theTest = "eMail" then
      put specialFolderPath("Documents") & slash & "test.pdf" into tPDFFile 
      delete file tPDFFile 
      open printing to pdf tPDFFile
      #mergDocShowOpenInMenu tPDFFile
      mergDocShowOptionsMenu tPDFFile
      if "Menu Shown" is not in the result then answer "Print PDF returned" && the result
      #delete file tPDFFile 
   end if
   lock screen for visual effect
   set the backgroundcolor of this stack to "255, 245, 220"
   unlock screen with visual effect dissolve 
end goPrint

Re: how can I print a card from iPad?

Posted: Mon Jul 15, 2013 5:20 am
by maxs
OK Can I print a document or PDF from Livecode on an ipad?

I tried this code. It seems to turn a card into a pdf. I just want to print a pdf.
on mouseUp
## we are allowed to write here:
put specialfolderpath("documents") & "/Name of your pdf here.pdf" into tPrintPDF
open printing to pdf tPrintPDF
print this card
close printing

## Check if file has been created, optional :-)
answer (there is a file tPrintPDF)

## Will be TRUE on success, FALSE otherwise
end mouseUp