Printing to pdf cuts off portion of card

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

Printing to pdf cuts off portion of card

Post by JereMiami » Wed Dec 23, 2020 3:26 am

So I've had two posts with this whole printing to pdf thing on android. Overall, great results.

1) How do I get it to save to the document folder? And, Klaus totally answered that.
2) How do I display that pdf once it's saved? And, Bernard totally answered that.

Now, one more and I think I am set. For some reason the following code cuts off the right and bottom of the card being printed. Both on the IDE (and desktop web browser to display) and on the android device:

--
on mouseUp
put specialfolderpath("documents") & "/lms.pdf" into tPDFPath
open printing to pdf tPDFPath
print card
close printing
end mouseUp
--

Any thoughts on why it is doing that?

JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

Re: Printing to pdf cuts off portion of card

Post by JereMiami » Wed Dec 23, 2020 3:45 am

I resolved this issue! Put a grc over the entire cd and voila:

--
on mouseUp
put specialfolderpath("documents") & "/lms.pdf" into tPDFPath
open printing to pdf tPDFPath
print this card into the rect of graphic "printArea"
close printing
end mouseUp

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Printing to pdf cuts off portion of card

Post by SparkOut » Wed Dec 23, 2020 11:50 am

At a guess, it is because the page default of the pdf virtual printer is not the same as the size of the card you are printing. You can set up the page size to match the card before printing, and then print into "the printRectangle". It is something I have done on Windows, anyway.

JereMiami
Posts: 119
Joined: Mon Nov 03, 2014 12:17 am

Re: Printing to pdf cuts off portion of card

Post by JereMiami » Mon Nov 08, 2021 7:57 am

I wanted to come back to this. When you are printing a card, at least with an image from mobile (android), it appears that the maximum image size that the card will print is approximately 594x768. So there you go to avoid any part of the image (or card, not sure if its the image or the card to be honest) being cut off. Don't have your image or your card exceed that dimension and the whole thing will print perfectly.

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1208
Joined: Thu Apr 11, 2013 11:27 am

Re: Printing to pdf cuts off portion of card

Post by LCMark » Mon Nov 08, 2021 10:09 am

@JereMiami: I think its just because of the standard print settings - take a look at the printPaperSize and printMargins (and printGutter). The paper size will determine the size of the page generated in the PDF. If you use 'print into rect' then you get the whole of `the printRectangle` to play with. However, if you use `print card`, then the engine will layout the cards using the printMargins and printGutter (as you can print more than one per page - there's many other print properties too which affect this).

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”