[reportlab-users] Non-printable elements
Robin Becker
robin at reportlab.com
Mon Feb 7 05:24:13 EST 2011
On 04/02/2011 20:12, Dominique Bischof wrote:
> Is it possible to set individual elements (text, lines, etc.) to be visible when
> the PDF is viewed on the screen, but that do not show when printed? Note, I'm
> not looking to keep the entire page from printing, only parts of it.
........
This is possible using appearance dictionaries and forms; basically you need to
define a form called formName and then use it as the normal appearance of an
annotation.
eg (assuming we created a form with the display content) this will create and
show the form and a link in the form, but not show anything when printed. If you
don't need the clickable link don't do the linkURL bit.
> rect = (x0,y0,x0+width,y0+height)
> canv.freeTextAnnotation('','()',rect,relative=1,
> AP=PDFDictionary(dict(N=PDFObjectReference(canv._doc.getXObjectName(formName)))))
> canv.linkURL(url,rect,
> thickness=1,
> relative=1,
> color=None,#toColor((1.0,0,0)),
> Contents=PDFName('A'),
> AP=PDFDictionary(dict(N=PDFObjectReference(canv._doc.getXObjectName(formName)))))
> canv._formsinuse.append(formName)
--
Robin Becker
More information about the reportlab-users
mailing list