pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luca Rasconi" <luca.rasc...@keytech.it>
Subject watermarking
Date Tue, 01 Oct 2013 09:04:23 GMT
Hi all,
I'm new to this group, I'm pleased to meet you.

I've a web application from where users can download pdf and I would to
process the document before download to add a watermark.
I think to create a empty 1 page pdf with transparent background and then
place it onto the main document.
This is the java code

public void download(HttpServletRequest request, HttpServletResponse
response) {
  //create my empty document on the fly
  File f = FopManager.getInstance().transform(...);

  PDDocument watermarkDoc = PDDocument.load(f);
  PDDocument realDoc = PDDocument.load("maindoc.pdf");

  Overlay overlay = new Overlay();
  PDDocument resultDoc  = overlay.overlay(watermarkDoc, realDoc);
  resultDoc.save(response.getOutputStream());
}

All works fine but the transparency I expected. Where I'm wrong?

Thank you 

Luca Rasconi
Key Technologies
luca.rasconi@keytech.it
voice +39029052104
fax +390291390322
www.keytech.it




Mime
View raw message