high resolution when printing to pdf, either from images or pdf widgets
mark at livecode.com
Wed Aug 28 03:07:49 EDT 2019
On 2019-08-27 17:24, Dr. Hawkins via use-livecode wrote:
> I’ve seen references, even in the bug report, to “directly” printing
> to pdf from a widget.
I'm not entirely clear what Monte meant by 'print to pdf directly' in
of those comments... The 'print to pdf' mechanism in the engine isn't
really any different from the normal printing mechanism, its just that
rather than funnel the sequence of paths, images, text being rendered
through the system printer it funnels it through libcairo's
PDF output functionality.
> My experience has been that it still reduces the pdf to screen
Currently widgets render at screen resolution when printed - this
the PDF widget.
> I still insist they the fact that the engine *renders* the pdf, rather
> than including it, is a hard-core bug. I attached an example of
> including parts of a pdf into another.
You can insist this but you'd be wrong :)
If you want to augment an existing PDF with extra content then printing
any form is not what you want.
Even when the various rather large and technical moving parts (pdfium,
engine printing architecutre, engine pdf printer) involved in a
approach to printing pdf content displayed in stacks all align they
not result in the original pdf being embedded verbatim in the output.
In reality your 'example' of embedding isn't really embedding - its
editing a single object's stream to be clipped - PDF's in general tend
a fair bit more complicated than that in the general case and indeed not
most people would want and/or expect (immediate bug report if it did: I
a small region of a 100Mb PDF to PDF and my output file was > 100Mb -
[ I'd point out here that even CoreGraphics with its native/builtin
PDF doesn't preserve original PDF content when you render a PDF into a
printing context - indeed it tends to lose various annotations/metadata
enable text to be copy/pasteable from the PDF ]
> In the meantime, though, has anyone actually managed to get hi-res
> output of either a pdf, jpg, or png into an outputted pdf?
What you should find is that if you have a stack with an image object at
100x100 whose image (jpg or png) is actually 400x400, and then print it
then the full resolution of the image will be preserved. If this is not
then chances are there is a property set somewhere which is requiring
of rasterization of the image object meaning the original image data
preserved (both PNG and JPEG image data passes straight through to the
backend when possible).
> The only way I’m seeing at the moment would be a bizarre process in
> which the stack is duplicated at 400%, and a script looping through to
> expand and replace every field, reposition and change the text size,
> etc., and then open the 33”x44” file in preview (or whatever) and
> export from there as 8.5”x1” . . .
You shouldn't have to do that - all you should have to do is when
1) set the width and height of your PDF widget to Upscale * the original
2) import snapshot from pdf widget (make sure paintCompression is png)
3) hide pdf widget
4) set the width and height of the imported image to original size
6) delete image and show pdf widget
> *IF* I could export to pdf at object density, I’d temporarily use png
> extracted from the pdf with an external program.
You can - you just need to temporarily resize the pdf widget to upscale
size in points as suggested above and use import/export snapshot.
> And if I could fully figure out the pdf file structure, I could expand
> my example file to write a custom pdf merging the field output with
> other pdfs . .
In reality if you want original PDF preserved with additions on top then
that is your only option.
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode