Hi guys. Recently I need to remove watermarks in some pdfs and can't find tool for this. Unsure no good tools to modify pdfs in Linux. But I found PoDoFo library and wrote a tool which allows to do it. See patch in attachments.
This patch removes options content from pdf. It can handle whoe OCGs or select by name.
Usage
podofonooc <in.pdf> <out.pdf> [OC_name]...</out.pdf></in.pdf>
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, thank you for provide such good things.
By the way, I want to know how do you add watermark for the pdf? (I draw text as watermark but it can not be removed by this tool).
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Although "Name" is required key the pdf can be corrupt and does not contain it. Rule of thumb in podofo is to use MustGetIndirectKey on places which expects this key must be present as it will never return NULL but throw instead (mainly required keys). And use GetIndirectKey but always test for NULL for keys where one wants to do something if that key exists or maybe something else if does not (mainly optional keys). Or use MustGetIndirectKey when you want exception and GetIndirectKey when you do not want exception if the key does not exists.
Last edit: Michal 2020-08-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, thank you for provide such good things.
By the way, I want to know how do you add watermark for the pdf? (I draw text as watermark but it can not be removed by this tool).
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't add watermarks. I only remove them. I use this tool to remove watermark from old Shimano bike components manuals. I don't know how they create such pdfs. Anyway I believe there are numbers of various ways to add watermarks. In worst case they won't be distinguish from regular text or images.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Also you can use podofobrowser to see what exactly add your tool. In this case you will PDF file as a tree of nodes. But in this case you need to read PDF Reference to understand what you see.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This patch removes options content from pdf. It can handle whoe OCGs or select by name.
Usage
podofonooc <in.pdf> <out.pdf> [OC_name]...</out.pdf></in.pdf>
Hi, thank you for provide such good things.
By the way, I want to know how do you add watermark for the pdf? (I draw text as watermark but it can not be removed by this tool).
Thanks.
Here the pdf in which I removed watermark.
Would not it crash if these optional keys are not present?
Thanks. Fixed.
Last edit: Ivan Romanov 2020-08-10
Similarly here:
Although "Name" is required key the pdf can be corrupt and does not contain it. Rule of thumb in podofo is to use
MustGetIndirectKeyon places which expects this key must be present as it will never return NULL but throw instead (mainly required keys). And useGetIndirectKeybut always test for NULL for keys where one wants to do something if that key exists or maybe something else if does not (mainly optional keys). Or useMustGetIndirectKeywhen you want exception andGetIndirectKeywhen you do not want exception if the key does not exists.Last edit: Michal 2020-08-12
Thanks, fixed.
Nice tool, would be nice to also get a short man page for it. Still pushed the patch now as it is also a nice example!
Thanks for your contribution, it will be part of 0.9.7.
Hi, thank you for provide such good things.
By the way, I want to know how do you add watermark for the pdf? (I draw text as watermark but it can not be removed by this tool).
Thanks.
I don't add watermarks. I only remove them. I use this tool to remove watermark from old Shimano bike components manuals. I don't know how they create such pdfs. Anyway I believe there are numbers of various ways to add watermarks. In worst case they won't be distinguish from regular text or images.
Also you can use podofobrowser to see what exactly add your tool. In this case you will PDF file as a tree of nodes. But in this case you need to read PDF Reference to understand what you see.