[reportlab-users] Issues related to setting parameters of graphs, lines, and rectangles, and they are not printing correctly

J. R. Carroll jrcarroll at jrcresearch.net
Thu Jan 17 13:08:37 EST 2013


Hi Robin (and list),

As a delayed followup to the 'watermark' request, I have successfully
'trimmed' out the necessary components from the example you have given me
that deals with the 'watermark'; I'll admit, most of it seems like
post-script/RL magic to me, as I can't find API references to XObject and
freeTextAnnotation just says "DA is the default appearance string???" - so
I'm assuming it's an undocumented feature (maybe?).

To describe the scenario, I am drawing a strip chart grid (attached is an
example) - the color I want displayed on the screen is "Salmon" - the color
I want to print in is "slate-gray". My approach was to put the salmon
color as the watermark, that way it shows on screen and is on top of the
slate-gray grid (I'm overlaying them) - and when I print, the salmon is
ignored, and the slate-gray is what is printed (slate-gray, and other
darker colors print much nicer and have less loss when the PDF gets
rasterized).

However, I am getting different, behaviors on Linux (where I build) and
Windows (my target environment). I'm suspecting it is an Adobe setting,
but I haven't not been able to find it.

Problem#1: On Linux, I can see that the overlaying/watermark trick works.
On Windows, all I see is the "slate-gray" on the screen (the slamon
watermark will not show). I've looked for 'watermark' specific keywords in
Adobe Reader X, but nothing has worked - because of the 'magic' of this
little script, I suspect that this isn't a traditional watermark, but
rather a workaround to generate the effect of a watermark - so I looked for
other settings as well, specifically for "form", but I cannot find it.
Anyone have ideas on where in Adobe Reader X (and more specifically google
chrome pdf reader) where I can make it display properly

Problem#2: Even on Linux, their is another issue in that I need this
watermark to exists "between layers" of the document - currently it demands
that it sits on top of everything. More specifically, I am drawing on this
grid (see the attached PDF). I have three "distinct layers" (in a
non-reportlab specific sense). The base grid, which is slate-gray (and
what SHOULD print). The salmon grid, which is for screen only, and SHOUT
NOT print. And the EKG waveforms that are on top of the grids. Currently,
with the way it's setup, the watermark ALWAYS draws on top of everything,
so my waveforms are covered up. It's not just my script - the one I was
sent also behaves the same way (if you try drawing a string to the canvas
at the same coordinates of the watermark, the watermark always falls on
top). Is there a way to make the watermark draw between layers? I
understand that I can draw my waveforms in the watermark, but the drawing
already takes ~7 sec, and that would most certainly double my time if I not
only redrew the grid, but also all the waveforms. Any ideas here?

Attachment: the attachment will display the watermark correctly in Linux
using Evince. If you open it up in Windows, at least in my case, it
doens't show the same watermark behavior (just the base grid that should
show during printing). You should be seeing a smaller slate-gray grid
inside and on top of the salmon grid. If you aren't seeing it, then your
settings are foobar too.

I've stripped out most of the code you sent me and created a slim version,
which appears to work:

# Draw one MAJOR grid for the entire page!

> def make_form_grid(canv, formName='watermark'):

> if not canv.hasForm(formName):

> canv.beginForm(formName,0,0,800,500)

> draw_grid(doc=report, xorigin=20, yorigin=50, time=265,

> mv=140, sec_tick=0, render=1, color=0)

> canv.endForm()

> return formName

>

> def nAppearance(canv,formName):

> from reportlab.pdfbase.pdfdoc import PDFDictionary,

> PDFObjectReference

> rect = (0,0,0,0)

> canv.freeTextAnnotation('','()',rect,relative=1,

>

> AP=PDFDictionary(dict(N=PDFObjectReference(canv._doc.getXObjectName(formName)))))

> canv._formsinuse.append(formName)




draw_grid(doc=report, xorigin=20, yorigin=50, time=265, mv=140,

> sec_tick=0, render=1, color=1)


new_form = make_form_grid(report)


NB: This code won't work for you because you don't have "draw_grid()", but
you can just as easily replace it with a drawString() to test it out.


-J


----


J. R. Carroll
Independent Researcher through Hurtz Labs
Research Methods, Test Development, and Statistics
www.jrcresearch.net
www.ontvp.com
Cell: (650) 776-6613
Email: jrcarroll at jrcresearch.net
jrcarroll at hurtzlab.com
jrc.csus at gmail.com
<https://www.facebook.com/J.R.Car>
<https://twitter.com/jNammer><http://www.linkedin.com/in/jrcarroll>



On Fri, Dec 7, 2012 at 3:55 PM, J. R. Carroll <jrcarroll at jrcresearch.net>wrote:


> ha!

>

> Too picky? Never! Obsessed with perfection? Perhaps =P

>

> And I'm glad that something I've done is helping you, I know it's saving

> us a lot of time.

>

> Even at the 2400 dpi setting, the lines in

>> your grid are dithered at what appears to be an unacceptable 150 dpi.

>> The dither pattern is so obviously visible under a magnifying glass that

>> it looks like an embroidered cross-stitch.

>

>

> Interesting... I'm not 'jive' to all the printing terms - as of yet - but

> I assume by "dither" you mean the color mixture chosen by the printer to

> represent the different colors produced by reportlab. If so, out of

> curiosity, are you getting the anti-aliasing issue I was having when you

> print the same chart in grayscale/monochrome? I'd love to hear if this is

> just me experiencing these issues and if the PDF grid document is a

> decent/reliable litmus test for at least some qualities of the output of a

> printer (it'll help me decide if I should push to have something like this

> included in our source code for debugging/troubleshooting purposes).

>

> Thanks again for the FYI.

>

> -J

>

> ----

>

>

> J. R. Carroll

> Independent Researcher through Hurtz Labs

> Research Methods, Test Development, and Statistics

> www.jrcresearch.net

> Cell: (650) 776-6613

> Email: jrcarroll at jrcresearch.net

> jrcarroll at hurtzlab.com

> jrc.csus at gmail.com

>

>

>

>

>

> On Fri, Dec 7, 2012 at 3:08 PM, Tim Roberts <timr at probo.com> wrote:

>

>> I thought you would be amused to know that your grid PDF is helping me

>> choose a printer. My faithful Dell 3100cn died yesterday, so I need a

>> replacement. We have a new Brother MFC-9970CDW at work that I like, so

>> I ran your grid through it. Even at the 2400 dpi setting, the lines in

>>

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130117/4e16051d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug.pdf
Type: application/pdf
Size: 10785 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130117/4e16051d/attachment-0001.pdf>


More information about the reportlab-users mailing list