pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Jerman <st...@kloudspot.com>
Subject Setting background transparency for imported PDFormXObject
Date Sun, 26 Nov 2017 18:19:52 GMT
Hi,


I am creating an application that creates a report using a template page for each and then
positions graphics on each page.


To allow me to use vector based graphics, they are each imported as PDFs:


try (PDPageContentStream contents = new PDPageContentStream(doc, currentPage, AppendMode.APPEND,
true);

PDDocument imageDoc = PDDocument.load(pdfGraph);) {


LayerUtility layerUtility = new LayerUtility(doc);

PDFormXObject form = layerUtility.importPageAsForm(imageDoc, 0);

contents.saveGraphicsState();

Matrix matrix = Matrix.getTranslateInstance(rect.getLowerLeftX(), rect.getLowerLeftY());

contents.transform(matrix);

contents.drawForm(form);

contents.restoreGraphicsState();


}

Now, this seems to work fine. However, these is one issue ... I would like to have the background
of the imported graphic be transparent. At present it comes in with a white background.


Is there anyway to set a transparent background?


Thanks for any help

Steve


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