Are you basically trying to combine multiple PDF files into a single one?
If so, use the PDFMergerUtility
<https://pdfbox.apache.org/apidocs/org/apache/pdfbox/util/PDFMergerUtility.html>
class.

On Thu, Feb 12, 2015 at 12:11 AM, Vorpahl,Lucinda <[email protected]>
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
>

Reply via email to