pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Planow <jpla...@parchment.com>
Subject Re: PDFRenderer Does Not Respect ExportState or ViewState in OCGs?
Date Fri, 20 Jan 2017 16:53:25 GMT
Thanks for your response, Tilman.

Your attachments didn't get through but I can guess what you mean... we
> don't support the optional content groups while rendering, i.e. conditional
> rendering. That's more like a new feature than a bug. Rather advanced
> stuff. Yes create a new issue with your attachment(s) but don't expect this
> to be done quickly.
>

Maybe an initial update could be to support the ExportState setting? This
appropriate behavior with respect to this seems clearer, per the PDF spec
(1.7):

"This value indicates the recommended state for content in this group when
the document (or part of it) is saved by a viewer application to a format
that does not support optional content (for example, an earlier version of
PDF or a raster image format)."

As I mentioned, I'll be happy to take a look at the code to see if I can
implement a suitable solution in a reasonable amount of time.


> Another problem is that rendering does not "know" whether it is printing
> or viewing.


Yes, that's a very good point. It's not clear what the API should do
regarding the print setting, absent of these other settings.

With gratitude,
John

On Thu, Jan 19, 2017 at 11:01 PM, Tilman Hausherr <THausherr@t-online.de>
wrote:

> Am 20.01.2017 um 01:42 schrieb John Planow:
>
>> I'm using PDFRenderer.renderImageWithDPI() to create an image from a PDF
>> with a print watermark. The rendered image includes the watermark text. Is
>> this expected/desired behavior?
>>
>> Here are some additional details..
>>
>> I'm using a 2.1.0 snapshot of PDFBox.
>>
>> The test PDF (attached) has the watermark text in an Optional Content
>> Group. The dictionary for this OCG dictionary looks like this:
>>
>> <</Usage <</Export <</ExportState/OFF>>
>>            /View <</ViewState/OFF>>
>>            /Print  <</Subtype           /Watermark
>>  /PrintState        /ON >>>>
>>            /Type   /OCG
>>            /Name (watermark)>>
>>
>> I've attached the resulting image as well (outputImage.jpg). This doesn't
>> seem like the correct behavior and I'd be happy to file an issue and look
>> into it, but I want to be sure this isn't intentional.
>>
>
> Your attachments didn't get through but I can guess what you mean... we
> don't support the optional content groups while rendering, i.e. conditional
> rendering. That's more like a new feature than a bug. Rather advanced
> stuff. Yes create a new issue with your attachment(s) but don't expect this
> to be done quickly.
>
> Another problem is that rendering does not "know" whether it is printing
> or viewing.
>
> Tilman
>

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