Open Printing to PDF
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Open Printing to PDF
I'm using the Open Printing to PDF "MyPDF" command, yet nothing seems to happen and the rest of the script stops working.
Does it make a PDF of the card?
How does this work? Does if create a pdf the can be accessed by a printer?
Max
Does it make a PDF of the card?
How does this work? Does if create a pdf the can be accessed by a printer?
Max
Re: Open Printing to PDF
Hi Max,
especially on iOS you need to open printing to a PDF file where you have write permissions!
...
Open Printing to PDF "MyPDF.pdf"
...
will try to save the PDF in the current folder which maybe the ENGINE folder where you do not have write permissions!
Try something like this:
...
put specialfolderpath("documents") & "/Yourpdf.pdf" into tPDFFile
open printing to PDF tPDFFile
...
Best
Klaus
especially on iOS you need to open printing to a PDF file where you have write permissions!
...
Open Printing to PDF "MyPDF.pdf"
...
will try to save the PDF in the current folder which maybe the ENGINE folder where you do not have write permissions!
Try something like this:
...
put specialfolderpath("documents") & "/Yourpdf.pdf" into tPDFFile
open printing to PDF tPDFFile
...
Best
Klaus
Re: Open Printing to PDF
Thank you Klaus,
Thanks for the help. How do I access or find the file on the Ipad after it's created? Max
Thanks for the help. How do I access or find the file on the Ipad after it's created? Max
Re: Open Printing to PDF
Hi Max,
been busy?
Not sure I understand your question, you created the file so you know where it is, not?
Best
Klaus
been busy?
Not sure I understand your question, you created the file so you know where it is, not?
Code: Select all
...
put specialfolderpath("documents") & "/Yourpdf.pdf" into tPDFFile
## Creates the pathname to the PDF file
## Now do what you want with tPDFFile now.
...
Klaus
Re: Open Printing to PDF
Hi Klaus,
The documentation says
Starts a print loop that outputs directly to pdf rather that the currently configured printer.
It seems that I can print a card to a PDF file that is in a special "documents" folder. NO?
So where is the documents folder on the Ipad?
I seem to be completely misunderstanding this command.
Max
The documentation says
Starts a print loop that outputs directly to pdf rather that the currently configured printer.
It seems that I can print a card to a PDF file that is in a special "documents" folder. NO?
So where is the documents folder on the Ipad?
I seem to be completely misunderstanding this command.
Max
Re: Open Printing to PDF
Hi Max,
Due to "sandboxing" every app has its own "documents" folder.
Sorry, cannot provide more info since I don't develop for mobile nor do I own any mobile device.
Yes, no cell phone, that's me!
Best
Klaus
yes, exactly! And logical, since you need to supplay a valid filename.maxs wrote:It seems that I can print a card to a PDF file that is in a special "documents" folder.
Inside of your application package.maxs wrote:So where is the documents folder on the Ipad?
Due to "sandboxing" every app has its own "documents" folder.
Sorry, cannot provide more info since I don't develop for mobile nor do I own any mobile device.
Yes, no cell phone, that's me!
Best
Klaus
Re: Open Printing to PDF
Hi here is my button script in an iPhone app that prints a sub stack as a pdf and then displays in the mergReader external
Notes:
1. PDF print by default only prints the visible potion of the card, so if using an A4 or US sized card you need to specify the print area (i.e. 595x841 px for A4) since the iPhone shows a smaller screen area
2. Best to use a sub stack because of 1.
3. The mergReader extension is great, remember to include both it and the PDF printer in the IOS application inclusions
4. The "documents" app file location is the only place you can save files to (you can include pdf's when building but they end up in the "engine" folder and as far as i can tell its best to leave that alone - this is set as tFilePath with a file name of "frame.pdf"
5. I seem only able to output US letter sized PDF's not A4 size (see previous post) - if this is the case then the solution is to specify a pdf size of 8.27 inches (A4 width) by 11 inches (US letter height) i.e. 595 px x 792 px
6. I'm not sure if specifying say a double sized PDF would result in a higher quality photo output when scaled down to actual page size.
Hope this helps
Roger
Code: Select all
on mouseUp
--lock the screen as it seems you have to go to sub stack at least once to print it, I got glitches otherwise
lock screen
-- go to the stack to print
go to stack "a4paper"
--default margins are 72 points = 1 inch so reset to zero
set the printMargins to 0, 0, 0, 0
-- set the print path to the app documents folder
put specialFolderPath("documents") & "/frame.pdf" into tFilePath
--prepare the PDF document to the file path
open printing to PDF tFilePath
--specify the card to print and the area of the card (divide by 72 to get size)
print card "pdfprint" of stack "a4paper" from 0,0 to 595,841
--do the printing
close printing
--return to the main stack
go to stack "PDFPrinter"
-- all done
unlock screen
--use the mergReader external to display the pdf and offer printing email etc.
mergReader tFilePath
end mouseUp
1. PDF print by default only prints the visible potion of the card, so if using an A4 or US sized card you need to specify the print area (i.e. 595x841 px for A4) since the iPhone shows a smaller screen area
2. Best to use a sub stack because of 1.
3. The mergReader extension is great, remember to include both it and the PDF printer in the IOS application inclusions
4. The "documents" app file location is the only place you can save files to (you can include pdf's when building but they end up in the "engine" folder and as far as i can tell its best to leave that alone - this is set as tFilePath with a file name of "frame.pdf"
5. I seem only able to output US letter sized PDF's not A4 size (see previous post) - if this is the case then the solution is to specify a pdf size of 8.27 inches (A4 width) by 11 inches (US letter height) i.e. 595 px x 792 px
6. I'm not sure if specifying say a double sized PDF would result in a higher quality photo output when scaled down to actual page size.
Hope this helps
Roger
Re: Open Printing to PDF
ROger,
Thank you so much for this additional information.
Max
Thank you so much for this additional information.
Max
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Open Printing to PDF
Hi Max,
You can see it with iTunes if you set "file sharing" of your app to true in the standalone application setting.
Best regards
Jean-Marc
As Klaus said every app has its own "documents" folder.where is the documents folder on the Ipad?
You can see it with iTunes if you set "file sharing" of your app to true in the standalone application setting.
Best regards
Jean-Marc
https://alternatic.ch
Re: Open Printing to PDF
Thanks. This is very good to know. Max
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: Open Printing to PDF
This is a thread that I went thru when I was doing something similar. It might give you some ideas.
http://forums.livecode.com/viewtopic.php?f=49&t=24391
http://forums.livecode.com/viewtopic.php?f=49&t=24391
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: Open Printing to PDF
Thanks Tom, there is alot of good stuff here.