[SOLVED] Is there a way to convert an entire card to pdf and email it?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
[SOLVED] Is there a way to convert an entire card to pdf and email it?
I saw Quartam's PDF Library add on, but when I looked at the demo, it seems to recreate a form.
I have a VERY COMPLEX form I am working on in LiveCode. The process is: the user will add data and then press the submit button, which will write the data to a database and email a client a copy of the form as a attached pdf.
Is Quartam's PDF Library good for this (taking a snapshot of the entire form and convert it to pdf) or do I have to re-create it item by item???
If not, is there a solution for this?
Thank you
Mike
I have a VERY COMPLEX form I am working on in LiveCode. The process is: the user will add data and then press the submit button, which will write the data to a database and email a client a copy of the form as a attached pdf.
Is Quartam's PDF Library good for this (taking a snapshot of the entire form and convert it to pdf) or do I have to re-create it item by item???
If not, is there a solution for this?
Thank you
Mike
Last edited by karmacomposer on Mon Jul 23, 2018 3:03 pm, edited 1 time in total.
-
- Posts: 253
- Joined: Wed Aug 19, 2015 4:29 pm
Re: Is there a way to convert an entire card to pdf and email it?
This lesson shows how to export a card to PDF:
http://lessons.livecode.com/m/4071/l/29 ... g-livecode
http://lessons.livecode.com/m/4071/l/29 ... g-livecode
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: Is there a way to convert an entire card to pdf and email it?
This does work:
But how can I print the entire card - grouped and all (it's longer than the card and has a scrollbar)?
Is there a command to just print the whole thing? Can I set it to print a standard 8.5 x 11 - sheet of paper size?
Mike
Code: Select all
## Path to the pdf file we want to create
put specialFolderPath("documents") & "/PDAForm.pdf" into tPDFPath
open printing to pdf tPDFPath
## Print the card into the printable area
print card 1 of this stack into 0,0,1000,1024
close printing
Is there a command to just print the whole thing? Can I set it to print a standard 8.5 x 11 - sheet of paper size?
Mike
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: Is there a way to convert an entire card to pdf and email it?
I have to enlarge the group and card to 953,1612,500,820 and then issue the export pdf command.
Mike
Mike
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: Is there a way to convert an entire card to pdf and email it?
Here is what I have to enlarge the stack and group to for it to fit:
Here is the group before:
and here is the stack before:
Now to figure out how to code this?
I need to resize it up, print to pdf (already have that done) then resize it back.
Mike
Code: Select all
Stack scale up to:
scale factor 0.6
Width: 1020
Height: 1571
Location: 1040, 836
Code: Select all
Scale group up to:
Width: 953
Height: 1628
Location: 505,836
Left: 29
Top: 22
Right: 982
Bottom: 1650
Code: Select all
Group before:
Width: 946
Height: 942
Location: 493,484
Left: 20
Top: 13
Right: 966
Bottom: 955
Code: Select all
Scale Factor 1
Width: 985
Height: 976
Location: 701,526
I need to resize it up, print to pdf (already have that done) then resize it back.
Mike
-
- VIP Livecode Opensource Backer
- Posts: 7210
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Is there a way to convert an entire card to pdf and email it?
If you had only a single field, you could use the pageHeights property which was implemented to do what you want. But that property doesn't apply to groups, so you'll have to create your own list of page heights. See the dictionary to read about the method in general.
You'll need to manually create a list of scroll settings. If your group isn't going to change height, you'll only need to do that once during development. Scroll the group to where you want the page break and record the scroll. Do that repeatedly until you have a list of scroll settings. You can store the list in a custom property somewhere. Alternately you can calculate it in the script by adding the height of the group to the current scroll. The problem with that is that it's easy to cut lines in half, so you'll have to experiment.
Then you open printing for pdf, print the card, set the scroll of the group to the next line in your list, print the card again, and continue until the entire group has been printed. Then close printing, which is what actually sends the print job to the printer.
You'll need to manually create a list of scroll settings. If your group isn't going to change height, you'll only need to do that once during development. Scroll the group to where you want the page break and record the scroll. Do that repeatedly until you have a list of scroll settings. You can store the list in a custom property somewhere. Alternately you can calculate it in the script by adding the height of the group to the current scroll. The problem with that is that it's easy to cut lines in half, so you'll have to experiment.
Then you open printing for pdf, print the card, set the scroll of the group to the next line in your list, print the card again, and continue until the entire group has been printed. Then close printing, which is what actually sends the print job to the printer.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: Is there a way to convert an entire card to pdf and email it?
@Jacque: That seems overly complicated. Can't I simply increase the stack, card and group to full height, take the pdf snapshot and then resize the group, card and stack back again?
Mike
Mike
-
- Posts: 709
- Joined: Thu Sep 11, 2014 1:49 pm
- Location: The Netherlands
Re: Is there a way to convert an entire card to pdf and email it?
Just an idea...
Maybe it is possible to make a screenshot of the complete card en print the screenshot...
Regards,
Paul
Maybe it is possible to make a screenshot of the complete card en print the screenshot...
Regards,
Paul
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: Is there a way to convert an entire card to pdf and email it?
And that's exactly what I coded and it worked 100%
I resized the stack and the group, printed to pdf and then resized it back (height, width) using exact coordinates (left, right, top, bottom) - both the stack and the group.
Yeeehaawwwww
That's done!
Mike
I resized the stack and the group, printed to pdf and then resized it back (height, width) using exact coordinates (left, right, top, bottom) - both the stack and the group.
Yeeehaawwwww
That's done!
Mike