You can't set only a part of it transparent. You can only have some transparency effect on the whole thing.

Maybe there is some blending that would remove white, then this would remove the white everywhere, or maybe have other effects. Have a look here:
http://www.pdfvt.com/PDFVT_TransparencyGuide.html

It would be easier to remove the white background in the xobject form you want to invoke, especially if this is a one-time job. However this may be tricky, a "background" can be many things.

Tilman

PS: use the PDPageContentStream with 5 parameters (read the javadoc why), unless you know in advance what kind of PDFs you append to.


Am 26.11.2017 um 19:19 schrieb Steve Jerman:
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




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to