pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Jerman <st...@kloudspot.com>
Subject Re: Setting background transparency for imported PDFormXObject
Date Mon, 27 Nov 2017 19:32:02 GMT
Thanks for the answer. I'm bringing the plots from R and your answer prompted me to look at
some more options there. Found what I was looking for 😊


Also thanks for the PS .. will check

Steve

________________________________
From: Tilman Hausherr <THausherr@t-online.de>
Sent: Monday, November 27, 2017 10:05:06 AM
To: users@pdfbox.apache.org
Subject: Re: Setting background transparency for imported PDFormXObject

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: 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