How to export to PDF an exact area of a card.

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

How to export to PDF an exact area of a card.

Post by Fermin » Wed Dec 15, 2021 2:14 pm

Can anyone help me? I need to create a pdf with the exact capture of a certain area of a card, that is to say, that the pdf shows exclusively that area WITHOUT ANY MARGIN and with THE SAME PROPORTION.

The only thing I get is either that the pdf keeps the proportion but does not fit the image, or that it fits the image but changes the proportion.

I use the values "842,594" to define the paper (I think they correspond to DIN A4).

Thank you very much in advance.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to export to PDF an exact area of a card.

Post by Klaus » Wed Dec 15, 2021 2:54 pm

Hola Fermin,

we can -> print card [from topLeft to bottomRight] [into pageRect]
So maybe this will work for you?

Code: Select all

...
print card 1 from 50,50 to 300,600 into 50,50,300,600
...
Out of my head, but should work! (famous last words... :-) )
Hope I understood you correctly.


Best

Klaus

Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

Re: How to export to PDF an exact area of a card.

Post by Fermin » Wed Dec 15, 2021 4:28 pm

Thank you very much, Klaus and sorry for taking so long to reply.
What I get with your example is a landscape DIN A4 size pdf with the 50,50 to 300,600 capture inside and what I would need is for the document itself to be the exact size of that capture, i.e. in your example: 250 x 550 (300-50) x (600-50). . . . .
I'm looking at the Dictionary and I think the issue has to do with other properties like printPaperSize, etc. Let's see...

Translated with www.DeepL.com/Translator (free version)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: How to export to PDF an exact area of a card.

Post by dunbarx » Wed Dec 15, 2021 4:31 pm

Out of my head,
No surprises there...

Craig

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to export to PDF an exact area of a card.

Post by Klaus » Wed Dec 15, 2021 4:36 pm

Fermin wrote:
Wed Dec 15, 2021 4:28 pm
Thank you very much, Klaus and sorry for taking so long to reply.
What I get with your example is a landscape DIN A4 size pdf with the 50,50 to 300,600 capture inside and what I would need is for the document itself to be the exact size of that capture, i.e. in your example: 250 x 550 (300-50) x (600-50). . . . .
I'm looking at the Dictionary and I think the issue has to do with other properties like printPaperSize, etc. Let's see...

Translated with www.DeepL.com/Translator (free version)
Ah, I see, then you should also set the printpapersize etc. accordingly, like this:

Code: Select all

...
set the printpapersize to "250,550"
open pringting to PDF<filename>
set the printMargins to 0,0,0,0
print this cd from 50,50 to 300,600 into 0,0,250,550
close printing to PDF
...

Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

Re: How to export to PDF an exact area of a card.

Post by Fermin » Wed Dec 15, 2021 5:38 pm

Siiii!
Yes, it seems to be working, I have to do some definitive tests but I think it's fixed. Thanks once again Klaus. :)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How to export to PDF an exact area of a card.

Post by Klaus » Wed Dec 15, 2021 5:48 pm

De nada, Señor! :-)

Just corrected the first line in my example script.

Post Reply

Return to “Talking LiveCode”