Hi,
I have not gone to trouble of creating a standalone application, so as I understand it, Livecode (version 9.6.8 Build 15593) on a Mac has everything it needs for standard operation.
I have a card with buttons, labels, text fields on it.
One of the buttons is a "Print" button and it has an "on mouseUp" handler.
If I put the following code in, the card is printed on the printer:
open printing
print card 1;
close printing;
As expected.
However, nothing happens with the following code:
open printing to pdf "file:/Users/andrewtaylor/temp/myFile.pdf"
print card 1;
close printing;
Yet that is all that is needed to print to PDF according to the Dictionary and all documentation that I can find.
Either bug, or I am missing something fundamental.
The above simple code is nowhere near what I want to do - which is to present a dialog box so that the user can select various parameters as well as target either printer or PDF or Preview, but I can't even get the above to work.
Please Help!
Thanks,
Andrew
open printing to pdf - does not work
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 118
- Joined: Thu Sep 20, 2012 5:11 pm
Re: open printing to pdf - does not work
Remove "file:" and your code should work as expected.aetaylorBUSBnWt wrote: ↑Wed Sep 21, 2022 5:58 pmopen printing to pdf "file:/Users/andrewtaylor/temp/myFile.pdf"
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.com
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.com
-
- VIP Livecode Opensource Backer
- Posts: 118
- Joined: Thu Sep 20, 2012 5:11 pm
Re: open printing to pdf - does not work
arrgh!!
The simplest things!
So for those who want some print code with a dialog box and the option for PDF too.
The simplest things!
So for those who want some print code with a dialog box and the option for PDF too.
Code: Select all
//put this in whatever handler/function you want:
answer printer //get print options from user, including printing to a PDF
if the result is "Cancel" then exit "your handler name"
if printerOutput begins with "file:" then
local tWhere;
put the printerOutput into tWhere;
delete char 1 to 5 in tWhere;
open printing to pdf tWhere;
else
open printing;
end if
print card 1; //replace this with whatever you want to print.
close printing //this causes the actual printing or PDF creation.
Re: open printing to pdf - does not work
Hi Andrew,
using cr AND ; to delimit commands is OVERKILL!
The ; is used if you don't want a new line for the script.
These are identical:
Best
Klaus
using cr AND ; to delimit commands is OVERKILL!

The ; is used if you don't want a new line for the script.
These are identical:
Code: Select all
...
put the printerOutput into tWhere;delete char 1 to 5 of tWhere;open printing to pdf tWhere;
...
Code: Select all
...
put the printerOutput into tWhere
delete char 1 to 5 of tWhere
open printing to pdf tWhere
...
Klaus
Re: open printing to pdf - does not work
Yes, but since it doesn't hurt to put the semicolons there (I didn't know this before), it may be more comfortable for folks coming to xtalk from a different language environment where they're necessary to signify the end of every command statement.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev