Printing just one card to PDF [was Re: The owner of a selected control - a mystery]
livfoss at mac.com
Mon Feb 23 04:00:15 EST 2015
Thanks for the thought. Your suggestion brings us full circle. We started by taking screen shots as you suggested (on a Mac, so using cmd-shift-4), but found that when printed they were a bit fuzzy due to the 72 dpi resolution, so we were looking of a way to make them sharper. There was also an issue with Apple’s dreadful rewrite of ‘Pages’, but let’s not go there.
Earlier in fact I asked the list if it was possible to export a vector drawing (I really mean anything that wasn’t a bitmap in the first place from an LC standalone as something other than a bitmap. The answer that came back was not really, all exports are to bitmaps, but ‘print to PDF’ does achieve a higher resolution result in that the PDFs can be enlarged without loss of quality. After that I went down the PDF rabbit hole, which was interesting in itself like so much to do with LiveCode - one likes to store up knowledge for the future as well as trying to solve immediate problems.
In the case of this immediate problem, I think we’re just going to leave it with the screen shots which won’t be that much of an issue as users are more likely to look at the manual on screen rather than print it. But meanwhile, for my personal knowledge database, I am trying to understand how to generate a PDF which has exactly the same dimensions as the object which is being ‘printed’
> On 22 Feb 2015, at 23:51, Peter Haworth <pete at lcsql.com> wrote:
> Hi Graham,
> If this is for a manual, have you thought about taking a screenshot of the
> screen and pasting it into your favorite word processor? Almost all of
> them can create a pdf file these days.
> If you are on a Mac, you put a snapshot of a screen by holding down the
> shift-control-command-4 keys. The cursor will change to crosshairs. Make
> sure the crosshairs are over the window you want to capture then press the
> space bar followed by the return key. If you want to capture just a
> section of a window, use the crosshairs to draw a rectangle around that
> section instead of pressing the space bar, then press return.
> Then just past it into your wp document at the appropriate place. Sorry, I
> don;t know the equivalent key combinations for other platforms.
> I do this all the time for my product manuals and use Open Office to write
> them. I'm not over fond of OO but it's the only one I could find that can
> create a pdf file with a clickable index down the side showing all the
> manual's sections.
> On Sun Feb 22 2015 at 2:32:30 PM Graham Samuel <livfoss at mac.com> wrote:
>> Thanks Jacque, and Terry too. I expect I’ll hack it in the end by
>> following your advice. I think now that I can use the print into rect
>> version to actually enlarge the size of the card on the virtual paper,
>> which will generate the hi-res result I want. I will try that.
>> I just wanted a PDF representing the whole of a card with absolutely no
>> additional white space or extra pages, and I wanted the highest resolution
>> I could get. This is for illustrations in a manual that show the reader
>> what he or she will see on the screen. Results up to now have been a bit
>> fuzzy, which is where the hi-res idea comes from. Of course I don’t expect
>> bit-map images to look any sharper when they’re enlarged, but everything
>> else should.
>>> On 22 Feb 2015, at 21:08, J. Landman Gay <jacque at hyperactivesw.com>
>>> The printPaperSize reports the physical size of the sheet of paper. You
>> generally don't need to mess with that. Either restart LC to get rid of the
>> setting, or use resetPrinting from the message box to put everything back
>> to defaults. Remove that line of code. If your stack is smaller than the
>> size of the default PDF "paper," the handler was probably making it too
>> small to hold the content.
>>> If the problem is the other way (the default paper size isn't large
>> enough) then setting the printPaperSize is okay because you need more room.
>> In that case what you've got should work if you add some extra space for
>> the printer driver limitations.
>>> You're right about those, and you need to take those into account too.
>> Most printers can't print within a half inch of the top of the paper. If
>> you also have a top margin of, say, half an inch, then there's a full inch
>> at the top before the printing starts. Setting the topMargin to 0 will
>> still cause the top of the printout to start at the half inch required by
>> the printer driver. If the content of your stack is not located at the very
>> top of the card, then add that amount to the top gap as well.
>>> I usually create a separate printing substack that moves data into
>> carefully placed fields that are located at the very edges of the card.
>> That makes it easier to calculate where the printout will start. I know
>> that setting the margins to, say, 18, will add a quarter inch to the
>> printer's required margins and that's where the content will begin to
>> print. If I use a printmargin of 0 it will put the content right up against
>> the default limit of the print driver.
>>> Finally, if none of this works, then use the "print into rect" syntax.
>> LC will scale the printout to fit into the rectangle you specify.
>>> On 2/22/2015 4:41 AM, Graham Samuel wrote:
>>>> Not quite sure I understand this (I did once, but i’ve got rusty - oil
>> can!). I assumed that the following code would exactly fill a page:
>>>> set the printCardBorders to true
>>>> set the printPaperSize to (the width of this card) & "," & (the
>> height of this card)
>>>> set the printMargins to "0,0,0,0"
>>>> print this card
>>>> But maybe you're saying that there is some hidden factor here. One
>> thing I can think of in a physical bit of paper (which a PDF isn't, really)
>> is that only certain printers can print to the very edge, so there might be
>> a kind of hidden margin (is this "the available print area"?). I am not
>> sure if the printPaperRect comes into this: as far as I can see, it
>> shouldn't, since the printMargins are measured from the edge of the page
>> according to the LC Dictionary. The printing might be cropped if
>> edge-to-edge isn't available, but that should not increase the number of
>> pages printed, should it?
>>>> I will experiment some more.
>>>>> On 21 Feb 2015, at 21:14, J. Landman Gay <jacque at hyperactivesw.com>
>>>>> On 2/21/2015 10:11 AM, Graham Samuel wrote:
>>>>>> 1. When you print to a pdf file, you often get a blank page. I have
>>>>>> not yet found that the solution offered (putting a ‘print break’ into
>>>>>> the script) works for me.
>>>>> If the bounds of the printout overrun the available print area, LC
>> will push the content down to another page. It sounds like you may have
>> margins at either the top or bottom of the page that are too large to
>> accomodate the height of the printout.
>>>>> You can set the margins to a smaller number, or use the "print into
>> rect" syntax to scale the output to fit. Remember when dealing with margins
>> that the margins represent the amount of space around the rect of the card
>> itself. If your fields or other controls are not at the very edges of the
>> card, then they will be inset more than just the margin amounts.
>>>>> Jacqueline Landman Gay | jacque at hyperactivesw.com
>>>>> HyperActive Software | http://www.hyperactivesw.com
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> Jacqueline Landman Gay | jacque at hyperactivesw.com
>>> HyperActive Software | http://www.hyperactivesw.com
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode