Print to PDF not rendering correctly

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

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

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

Print to PDF not rendering correctly

Post by dunbarx » Sat Feb 11, 2017 5:01 pm

I have a project where a number of fields and line graphics are placed on a card. All looks fine.

But when I print to PDF, the fields are distorted. The bottom and sides of each field seem to be poorly rendered, as if the line width was a fraction of 1, sometimes barely there, sometimes partly there, whereas the top always comes out normally.

Now I think I know that there is an imperfect "mapping" of objects and their locations on a card in terms of "pixel math" and the actual location of lines within that world. I am not sure what I just said makes sense or is even true. But moving all those fields down one pixel, or any other amount, does not help. Each field has a weak bottom and sides.

Anyway, is this repairable? A rectangular graphic of lineWidth 1 always renders correctly, and I could frame the fields with them, but I would rather not.

Craig Newman

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

Re: Print to PDF not rendering correctly

Post by dunbarx » Sun Feb 12, 2017 12:46 am

Just tried taking a screenshot of the card, and exporting that (from the desktop) to pdf. Comes out much better, with none of the issues above.

But the screenshot itself is quite crisp. The pdf, though better, loses much of that sharpness. Is there something about making pdf's from either LC or a screenshot that causes this fuzziness? In other applications, a pdf is faithful to the original document.

In case it matters, LC 6.7, Mac OS 10.10.5. I bet it does not.

Craig.

PBH
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 95
Joined: Sun Feb 20, 2011 4:26 pm
Location: Vancouver Island, BC, Canada. ex.UK
Contact:

Re: Print to PDF not rendering correctly

Post by PBH » Sun Feb 12, 2017 5:44 am

Do you have any effects (like drop shadows or glows) applied to the fields, or more to the point, any of the controls behind them?

Reading this reminded me of a bug I found a few weeks ago, so I've just reported it. The problem manifests in the print (or PDF), and only occurs where controls are placed over another control that has an effect applied, then the frontmost control seems to be inheriting effects of the controls behind them. This can be a problem depending how you prefer to deign your app interface. This problem doesn't affect snapshots or the normal screen view of the card.

http://quality.livecode.com/show_bug.cgi?id=19251

Paul

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

Re: Print to PDF not rendering correctly

Post by dunbarx » Sun Feb 12, 2017 6:24 am

Paul.

Thanks for the reply.

Nothing, though. I can take a new card with, a bunch of new fields, and get the same poor rendering when I make a pdf. I have the fields utterly simple, no 3D, drop shadows or any other effects at all. Just simple rectangles that can hold text.

The problem with my workaround, to frame the fields with rectangular graphics, is that the lines for a graphic renders more boldly than for a field, though both have lineWidths of 1.
I want the crisp thin line I see on a card. I cannot get that with a pdf. Not sure a screen shot will help, but one is attached.

Craig
Attachments
PDF from Card.png

PBH
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 95
Joined: Sun Feb 20, 2011 4:26 pm
Location: Vancouver Island, BC, Canada. ex.UK
Contact:

Re: Print to PDF not rendering correctly

Post by PBH » Sun Feb 12, 2017 7:06 am

I think there's definitely a bug somewhere with this. I tried adding a graphic with a 1 pixel border next to a field with a 1 px border and they do not appear consistent in the rendered PDF.

The graphic has even borders all round, but the field certainly doesn't, the bottom right sides of the field appear thinner than the top and left in a rendered PDF...

... Well, I've just made a PDF and imported it into a graphics editor, there I can see the fields are made up of several elements, they appear to be the top and left, then the bottom and right borders, these are grouped together and then masked with a vectored shape, unfortunately they don't always line up too well, so the mask appears to obscure the bottom right borders.

It's getting a bit late here, so I'll do some more investigation tomorrow.

Paul

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5026
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Print to PDF not rendering correctly

Post by jacque » Sun Feb 12, 2017 5:21 pm

I'm not sure I understand the problem, but the fields have 3D turned on. If you want a plain rectangle, turn off 3D and set the border width to 1.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Print to PDF not rendering correctly

Post by dunbarx » Sun Feb 12, 2017 8:30 pm

Jacque.

They are not 3D, though I see why you might think so. Here is another screenshot of three fields. Only the bottom one is 3D. The others are ordinary.

Craig
PDF from card 3D and normal.png
PDF from card 3D and normal.png (9.49 KiB) Viewed 2819 times

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5026
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Print to PDF not rendering correctly

Post by jacque » Sun Feb 12, 2017 8:34 pm

I see. Yup, bug.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Print to PDF not rendering correctly

Post by dunbarx » Sun Feb 12, 2017 8:38 pm

Hi.

Did you try it yourself? In v.8 as well?

I will report this, but am devastated in that I do not have a way out of it. Never mind that this went unnoticed. I cannot render a simple field. And even if they fix it tonight, it will be fixed in v.8, not in v.6.

I am depressed. :(

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5026
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Print to PDF not rendering correctly

Post by jacque » Sun Feb 12, 2017 10:17 pm

I forgot you weren't using 8. No, I didn't try it. You could.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

PBH
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 95
Joined: Sun Feb 20, 2011 4:26 pm
Location: Vancouver Island, BC, Canada. ex.UK
Contact:

Re: Print to PDF not rendering correctly

Post by PBH » Mon Feb 13, 2017 12:10 am

After a few more tests, the most consistent results seem to be achieved by setting both the threeD and opaque properties of a field control to false. This may not be the best setting if you want the field to be a different colour to the card background.

I tested making PDFs both from the LC print to PDF function and also using the Mac's Printer Dialogue - Print to PDF.
My conclusion so far is:
The LC print to PDF function produces inconsistent borders for a field control when the threeD property and the opaque prop are both set to true.
The Mac's native print to PDF doesn't seem to suffer the same inconsistencies.

Further analysis using graphics software to open the PDF files shows the field border in the LC Print to PDF file is 2 px smaller than the same border in the Mac Print to PDF file! This may account for the discrepancies, especially when you see that the border is rendered behind the field fill (background).

I also noticed some visual inconsistencies can occur with different PDF viewers, especially when the PDF is rendered at sizes other than 100% or multiple of 100%.

The results from LC6.7.8 are consistent with the results from LC8.1.3(rc2).

Test files are here if anybody wishes to experiment further: https://www.dropbox.com/s/mwqjdfshyuap1 ... s.zip?dl=0

Paul

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

Re: Print to PDF not rendering correctly

Post by dunbarx » Tue Feb 14, 2017 6:21 pm

Panos confirms it is a bug (#19252), longstanding through v8.1x.

Great. My problem is that I still like the look and feel of v.6, and the bug will certainly not be fixed back there.

Rats.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5026
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Print to PDF not rendering correctly

Post by jacque » Tue Feb 14, 2017 7:04 pm

Craig, try to get used to 8. The features hugely outweigh the appearance.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Print to PDF not rendering correctly

Post by dunbarx » Tue Feb 14, 2017 9:41 pm

Jacque.

I guess I will have to. But the appearance...

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5026
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Print to PDF not rendering correctly

Post by jacque » Wed Feb 15, 2017 1:06 am

It's open source, you can snazz it up and submit. :)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Talking LiveCode”