Create a PDF with LiveCode server
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 27
- Joined: Wed Nov 15, 2006 11:27 am
Create a PDF with LiveCode server
Hi all,
do I need use Qartam to create a PDF with LiveCode server or I can trigger the "open printing to pdf" command in a LiveCode stack?
Can I use the on-rev.com server with LiveCode server 6.5 ?
Best regards,
Paolo Mazza
do I need use Qartam to create a PDF with LiveCode server or I can trigger the "open printing to pdf" command in a LiveCode stack?
Can I use the on-rev.com server with LiveCode server 6.5 ?
Best regards,
Paolo Mazza
Paolo Mazza
Italy
Italy
-
- Posts: 27
- Joined: Wed Nov 15, 2006 11:27 am
Re: Create a PDF with LiveCode server
I switched to LiveCode Server 7.1
I inserted the following code in my stack "printpdf.livercode" and when I trigger my command "stampaPdf" i get the OK message from the server.
However I can not see any PDF file in the folder. Why?
I set the permissions of the folder to 777. This stack works fine locally. Any idea?
function PrintPdf myfilename myoptions
reset printing
set the formatforprinting of this stack to "false"
set the printPaperSize to "842,595" # e.g. for A4: 595,842
set the printMargins to 0,0,0,0
open printing to PDF myfilename with options myoptions
print this card
close printing
reset printing
end PrintPdf
on StampaPdf
go to card 1 of this stack
-- nome del file pdf
set itemdelimiter to "/"
put the filename of this stack into myfilename
put "document1.pdf" into last item of myfilename
put PrintPdf(myfilename,myoptions) into MessErr
if MessErr is empty then
put "OK"
else
put MessErr
end if
end StampaPdf
I inserted the following code in my stack "printpdf.livercode" and when I trigger my command "stampaPdf" i get the OK message from the server.
However I can not see any PDF file in the folder. Why?
I set the permissions of the folder to 777. This stack works fine locally. Any idea?
function PrintPdf myfilename myoptions
reset printing
set the formatforprinting of this stack to "false"
set the printPaperSize to "842,595" # e.g. for A4: 595,842
set the printMargins to 0,0,0,0
open printing to PDF myfilename with options myoptions
print this card
close printing
reset printing
end PrintPdf
on StampaPdf
go to card 1 of this stack
-- nome del file pdf
set itemdelimiter to "/"
put the filename of this stack into myfilename
put "document1.pdf" into last item of myfilename
put PrintPdf(myfilename,myoptions) into MessErr
if MessErr is empty then
put "OK"
else
put MessErr
end if
end StampaPdf
Paolo Mazza
Italy
Italy
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Create a PDF with LiveCode server
Edit. Was wrong, sorry.
Last edited by [-hh] on Wed Jun 29, 2016 11:33 am, edited 1 time in total.
shiftLock happens
Re: Create a PDF with LiveCode server
I don't see anything itemdelimiter related in the "printPDF" function!?
However:
1. The parameters should be separated by comma -> function PrintPdf myfilename, myoptions
2. The parameter "myoptions" is EMPTY, so it will resolve to the string "myoptions", but the engine exspects an ARRAY here.
However:
1. The parameters should be separated by comma -> function PrintPdf myfilename, myoptions
2. The parameter "myoptions" is EMPTY, so it will resolve to the string "myoptions", but the engine exspects an ARRAY here.
-
- Posts: 27
- Joined: Wed Nov 15, 2006 11:27 am
Re: Create a PDF with LiveCode server
My script works locally and create the pdf.
But in the server it does not work.
But in the server it does not work.
Paolo Mazza
Italy
Italy
Re: Create a PDF with LiveCode server
What is still puzzling me is that I am not sure that Livecode Server actually
can work with stacks except for library stacks!?
Or did I miss that new "feature" of LC server?
can work with stacks except for library stacks!?
Or did I miss that new "feature" of LC server?
-
- Posts: 27
- Joined: Wed Nov 15, 2006 11:27 am
Re: Create a PDF with LiveCode server
Hi Klaus,
I changed the script according to your suggestions, but still the following script do not work using the on-rev LiveCode Server ; I get the OK message but not any pdf shows up in the folder.
function PrintPdf myfilename, myoptions
reset printing
set the formatforprinting of this stack to "false"
set the printPaperSize to "842,595" # e.g. for A4: 595,842
set the printMargins to 0,0,0,0
open printing to PDF myfilename with options myoptions
print this card
close printing
reset printing
end PrintPdf
on StampaPdf
go to card 1 of this stack
-- nome del file pdf
set itemdelimiter to "/"
put the filename of this stack into myfilename
put "attestato.pdf" into last item of myfilename
-- opzioni pdf
put "xxx" into myoptions["Title"]
put "xx" into myoptions["Author"]
-- stampa PDF
put "ANNARITA DE BAGGIS" into field "nome" of card 1
put "Padova, 27 maggio 2014" into field "giorno" of card 1
put "nata a Roma il 17/11/1969" into field "nascita" of card 1
put PrintPdf(myfilename,myoptions) into MessErr
if MessErr is empty then
put "OK"
else
put MessErr
end if
end StampaPdf
I think Livecode Server can actually work with stacks. As an example I was able to create a new text file using the following script:
set itemdelimiter to "/"
put the filename of this stack into INDIRIZZO
put "prova.txt" into last item of INDIRIZZO
put "file:" & INDIRIZZO into INDIRIZZO
put "HKJHJ" into URL INDIRIZZO
put "ok"
exit to top
All the best,
Paolo
I changed the script according to your suggestions, but still the following script do not work using the on-rev LiveCode Server ; I get the OK message but not any pdf shows up in the folder.
function PrintPdf myfilename, myoptions
reset printing
set the formatforprinting of this stack to "false"
set the printPaperSize to "842,595" # e.g. for A4: 595,842
set the printMargins to 0,0,0,0
open printing to PDF myfilename with options myoptions
print this card
close printing
reset printing
end PrintPdf
on StampaPdf
go to card 1 of this stack
-- nome del file pdf
set itemdelimiter to "/"
put the filename of this stack into myfilename
put "attestato.pdf" into last item of myfilename
-- opzioni pdf
put "xxx" into myoptions["Title"]
put "xx" into myoptions["Author"]
-- stampa PDF
put "ANNARITA DE BAGGIS" into field "nome" of card 1
put "Padova, 27 maggio 2014" into field "giorno" of card 1
put "nata a Roma il 17/11/1969" into field "nascita" of card 1
put PrintPdf(myfilename,myoptions) into MessErr
if MessErr is empty then
put "OK"
else
put MessErr
end if
end StampaPdf
I think Livecode Server can actually work with stacks. As an example I was able to create a new text file using the following script:
set itemdelimiter to "/"
put the filename of this stack into INDIRIZZO
put "prova.txt" into last item of INDIRIZZO
put "file:" & INDIRIZZO into INDIRIZZO
put "HKJHJ" into URL INDIRIZZO
put "ok"
exit to top
All the best,
Paolo
Paolo Mazza
Italy
Italy
Re: Create a PDF with LiveCode server
Hm, LC Server is a scripting engine like PHP, could you please show your .lc or .rev script that you are calling with your browser?
-
- Posts: 27
- Joined: Wed Nov 15, 2006 11:27 am
Re: Create a PDF with LiveCode server
<?lc
go stack "printpdf.livecode"
send "StampaPdf" to stack "printpdf.livecode"
?>
I get "OK" from the server.
go stack "printpdf.livecode"
send "StampaPdf" to stack "printpdf.livecode"
?>
I get "OK" from the server.
Paolo Mazza
Italy
Italy
Re: Create a PDF with LiveCode server
Very strange!? The dictionary does NOT list "server" in the supported platforms for "go stack ..." nor "open printing to PDF..."!
So I highly doubt this is possible at all!
So I highly doubt this is possible at all!
-
- Posts: 27
- Joined: Wed Nov 15, 2006 11:27 am
Re: Create a PDF with LiveCode server
See this lesson
http://lessons.livecode.com/m/4070/l/36 ... ode-server
They use:
go stack "<path to stack>"
http://lessons.livecode.com/m/4070/l/36 ... ode-server
They use:
go stack "<path to stack>"
Paolo Mazza
Italy
Italy
Re: Create a PDF with LiveCode server
Buongorno Paolo,
But they also write:
...
However, visual and graphical commands are not supported (e.g. export snapshot).
...
This is of course a bit sparse but I, personally, count printing to these limitations.
#
Best
Klaus
yes, as a synonym for "start using stack xyz".PaoloMazza wrote:...They use:
go stack "<path to stack>"
But they also write:
...
However, visual and graphical commands are not supported (e.g. export snapshot).
...
This is of course a bit sparse but I, personally, count printing to these limitations.
#
Best
Klaus