pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Wills <don.wi...@portablesoftware.com>
Subject question about creating a PDF - layers and PDPageContentStream
Date Sat, 05 Jan 2019 20:30:41 GMT

I'm a newbie to PDFBox.  It appears to be a very useful tool for what we're trying to accomplish.

FWIW, in the past we have been building our own raw PDF files from scratch for simple printed
output from Java code.  It was tedious, but with a minimal API on top, it worked.  Thus I
have a bit of knowledge about the structure of a PDF, but not much more.

I have noticed that when images, text and graphics are mixed in a single PDPageContentStream
in no particular order, it appears that the elements are displayed and printed in layers.
 From my initial tests, it appears that graphics (lines and filled polygons) are at the lowest
layer, text is above the graphics, and images are on top of graphics and text.  Is that correct?
 Is that a feature or an accident?  Is that a feature of the PDF spec or PDFBox?  Is that
behavior documented anywhere?

I need to put a watermark on each page of a report.  So for each page of the report I create
a PDPageContentStream, draw the watermark image on that content stream, close it, and then
create a second PDPageContentStream in APPEND mode for the page that contains the text, graphics
and images of the page.  All seems to work well. Is that the correct approach, or is there
another better method?

Also, is there a place where I can search for answers to questions like this?  I'm sure this
particular question has been answered before.  I couldn't find anything on StackOverflow and
I have no idea how to search the archives of this email list.


Don Wills
Portable Software Company
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

View raw message