Yeah - this is one of those things you simply can NOT do with a pure 
stream-based solution.  You need a higher level abstraction - aka a "display 
list".

Leonard

-----Original Message-----
From: 1T3XT BVBA [mailto:[email protected]] 
Sent: Tuesday, June 21, 2011 11:53 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] iText: how to remove the layer (watermark)?

On 21/06/2011 17:36, olexiy wrote:
> Could you just give me an example code?

No, I've spent a full day coding to parse the content stream and to remove 
specific OCG layers.
It works and it doesn't work.
It works in the sense that the correct PDF syntax is removed.
It doesn't work in the sense that for some PDFs the state operators are no 
longer balanced if you remove stuff like this /OC /SomeLayer BDC q some q 
syntax Q EMC As you can see, there are two "save state" operators in this 
(pseudo) PDF snippet, and only one "restore state" operator.
I've written code to deal with this problem, but I can't just add 'q' or 'Q' at 
arbitrary places: in some cases, this results in a graphics state that is 
changed in a way that is not desired.

Of course, I'm working on a generic solution. Your case is much easier:

> Pdf files are always simple, without layers, one layer that contains 
> the watermark are added me.

Unfortunately for you, I'm not that interested in writing non-generic
code: it will work in some cases, but not in all. There is no honor in writing 
such code.
I'm sorry that you have a deadline. Are you a customer of iText Software Corp? 
If so, you may get help from their support.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content authoring 
tool. Experience the power of Track Changes, Inline Image Editing and ensure 
content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/ Please check the keywords list 
before you ask for examples: http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to