pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: Overlay PDF Docs
Date Wed, 11 Feb 2015 23:34:17 GMT
Hi Lucy,

Overlay is for adding something like a watermark to each page in an existing document.
To draw existing PDF pages onto a new page, follow our SuperimposePage example.

-- John

> On 11 Feb 2015, at 14:11, Vorpahl,Lucinda <vorpahl.lucinda@heb.com> wrote:
> 
> I am hoping someone can help me.
> 
> I have a list of PDDocuments that I want to combine and draw onto 1 PDDocument.
> I was able to do this by converting the individual documents to images then drawing the
image on the new document but I lost image quality.
> I was looking at the Overlay option but I'm getting the following error:
> 	"java.lang.UnsupportedOperationException: Layout pages with COSArray currently not supported."
> 
> I also tried this but nothing was happening.
> 
> 	PDPageContentStream contentStream;
>         PDDocument document = new PDDocument();
>         PDPage page = new PDPage();
>         document.addPage(page);
>         AffineTransform transform;
> for (PDDocument pdDocument : pdfDocList) {
>            LayerUtility layerUtility = new LayerUtility(document);
>            PDXObjectForm mountable = layerUtility.importPageAsForm(pdDocument, 0);
>            mountable.getPDStream().addCompression();
>            contentStream = new PDPageContentStream(document, page);
>            contentStream.appendRawCommands("q\n".getBytes("ISO-8859-1"));
> 
>            transform = new AffineTransform();
>            transform.translate(18.0f, 18.0f);
>            contentStream.drawXObject(mountable, transform);
> 
>            contentStream.appendRawCommands("Q\n".getBytes("ISO-8859-1"));
>            contentStream.close();
> 	pdDocument.close();
> }
> 
> Any help would be appreciated.
> 
> 
> Thanks,
> Lucy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message