You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by vakul <va...@newgen.co.in> on 2017/04/10 13:34:00 UTC
How to add markups to an existing OCG in a pdf
Hi,
I want to implement functionality to allow user to create layers(Optional
content group). Then, allow them to select a layer and add markups, text to
that layer. I have implemented the functionality to create layers using the
LayerUtility class. But, I am not able to modify an existing layer.
I tried to convert the PDOptionalContentGroup to PDPage by first converting
PDOptionalContentGroup to COSDictionary and then creating the PDPage from
the COSDictionary. Then making the changes in the PDPage. But this creates
an invalid PDPage.
So, how do I modify an existing layer(optional content group) in a pdf?
Best regards,
Vakul
Disclaimer :- This e-mail and any attachment may contain confidential, proprietary or legally privileged information. If you are not the original intended recipient and have erroneously received this message, you are prohibited from using, copying, altering or disclosing the content of this message. Please delete it immediately and notify the sender. Newgen Software Technologies Ltd (NSTL) accepts no responsibilities for loss or damage arising from the use of the information transmitted by this email including damages from virus and further acknowledges that no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of NSTL.
Re: How to add markups to an existing OCG in a pdf
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 10.04.2017 um 15:34 schrieb vakul:
> Hi,
>
>
>
> I want to implement functionality to allow user to create layers(Optional
> content group). Then, allow them to select a layer and add markups, text to
> that layer. I have implemented the functionality to create layers using the
> LayerUtility class. But, I am not able to modify an existing layer.
>
> I tried to convert the PDOptionalContentGroup to PDPage by first converting
> PDOptionalContentGroup to COSDictionary and then creating the PDPage from
> the COSDictionary. Then making the changes in the PDPage. But this creates
> an invalid PDPage.
>
> So, how do I modify an existing layer(optional content group) in a pdf?
>
>
I don't see how this would be possible easily. Please open a file with
PDFDebugger before and after adding optional content, so that you can
see what is done. To modify one existing OCG you would have to modify
inside the content stream (unless you only add stuff). PDF isn't made
for editing. Why not store what you want in some extra format, and then
create the PDF with this data after the user has decided what's wanted?
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org