[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: watermarking PDF

Subject: Re: watermarking PDF
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 29 Nov 2011 19:51:09 -0500
Re:  watermarking PDF
At 2011-11-30 01:41 +0100, Geert Bormans wrote:
What would be the best way to add a watermark to a PDF using xsl:fo?
Something like "Confidential" accross the page

I assume I need to make an image and use a background-image

Sticking to XSL-FO, yes, but ....


How can I make that almost fill the page (given I also have header and footer)

By segmenting the graphic into the different region dimensions and giving applying the different fragments to the regions.


Not pretty. And there are no scaling facilities in the standard XSL-FO vocabulary for the image background. And who knows if the registration of the rendered images would look seamless?

In my work I use a post-process on the PDF using iText to add the watermark.

If you knew the Z-level of the regions produced by your formatter (the region Z-levels are not standardized and vary between different products), you could create overlapping regions. Say, make the "start" region the size of the page, and then render a scaled image in that region. If that region's Z-level is below the body region, then you'll get a watermark effect (if not, it will obscure your content).

Note that technically you would be triggering an error condition, so the formatter may not support you on this: the foreground of any one region is not supposed to occupy the same printed dot as the foreground of any other region. This is not a problem with the backgrounds, only the foregrounds. When I use overlapping regions for my UBL invoice rendering, I make sure the foregrounds are mutually exclusive.

So, I suppose, you could have a single overlapping "start" region behind your body, header and footer regions, and then put your one non-fragmented image into the start region background .... *if* the Z-level of the start region is lower than that of the other three regions for your vendor's tool.

Would that work for both FOP and AntennaHouse?
Would .jpg be the best image format

I don't think there is a "best" ... JPG would be nice and small compared to, say, TIFF.


I hope this helps.

. . . . . . . . . . . . . Ken

--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/t37DVX
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.