pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: question about creating a PDF - layers and PDPageContentStream
Date Sun, 06 Jan 2019 06:40:17 GMT
Am 05.01.2019 um 21:30 schrieb Don Wills:
> Hello,
>
> 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?


It depends on the order in the content stream. This can be chosen freely.

See the PDF specification...


>
> 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?


Yes that is one solution.


Another is to append and to use transparency.



>
> 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.


"pdfbox watermark" finds a few on stackoverflow.


Tilman


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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message