pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: PDFBox drawXObject alpha channel
Date Fri, 09 Jan 2015 01:23:35 GMT
Yes, there’s not a built-in API for this, so you have to write the
PDF commands out yourself. PDF uses an external graphics state
object which you can enable with the “gs” operator:

Assuming you have a PDPageContentStream named “contents”:

PDExtendedGraphicsState gs1 = new PDExtendedGraphicsState();
gs1.setNonStrokingAlphaConstant(.33f);
page.getResources().put(COSName.getPDFName("gs1"), gs1);

… do what you like here

contents.saveGraphicsState()
contents.appendRawCommands("/gs1 gs\n”);
… draw your from
contents.restoreGraphicsState()

-- John

> On 8 Jan 2015, at 10:52, Gilles Coppex <g.coppex@gmail.com> wrote:
> 
> Dear all,
> 
> Can we reduce the alpha channel before calling the drawXObject() method?
> I would like to embedd the other pdf with a 33% transparency.
> 
> 
> P.S.: I reposted this question as a new thread because it seems more
> logical to separate topics.
> 
> Thanks a lot
> 
> G. Coppex


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