Can I use iText to merge PDF's with Permissions -
i want merge several pdf documents one. source documents can consist of pdfs created me , others created other organisations. have no control on permissions attached documents not created me. of these documents (those not created me) may have permissions set. if document requires password open not attempt merge it.
i using itext 5.5.1 (i think latest) create pdfcopy object contain resulting document , reader each source pdf in loop (i passing list of documents merged). check each document number of pages , using pdfcopy object import each page , add pdfcopy object (the reason these 2 steps separate due intricacies of language using work java objects, rpg on ibm iseries). problem can attach reader pdf permissions , page count, try import page copy object program complains , terminates message 'pdfreader not opened owner password'. not able person(s) providing documents other organisations not protect documents (there very, reasons why original document protected change) need consolidate these documents one.
my question is, can copy pdf's permissions new document using itext , can without knowing owner password? in addition guess other question be, legal?
thanks garrym
introduction: pdf file can encrypted using public certificate. if have such pdf, need corresponding private certificate decrypt it. pdf file can encrypted using 2 passwords: user password , owner password. if pdf encrypted using user password, need @ least 1 of 2 passwords decrypt it.
assumption: assume pdfs encrypted nothing owner password. can open these documents in pdf viewer without having provide user password, means content can accessed, there restrictions in place depending on permissions set.
situation: itext library allows access pdfs @ low level, without gui. can access pdf encrypted nothing owner password, can't check if respect permissions defined pdf. make sure aware of responsibilities, exception thrown saying pdfreader not opened owner password. strict: have permission assemble pdf file, itext it's all or nothing. either can open file, or can't. itext doesn't check you're doing afterwards.
solution: there static boolean parameter called unethicalreading set false default. can change this:
pdfreader.unethicalreading = true; from on, if pdfs aren't encrypted.
is legal? it's not clear , not lawyer, but:
it used illegal when adobe still owner copyright on pdf specification. adobe granted right use copyright developer on conditions. 1 of these conditions didn't "crack" pdf. removing password pdf broke "contract" adobe use pdf specification , risked being sued.
this changed when adobe donated pdf specification community in order make iso standard. every 1 can use international standard, , above (risk of being sued adobe infringing copyright) no longer exists.
as iso standard documents mechanism of encryption owner password , easy use iso standard decrypt document without having password, concept of introducing owner password enforce permissions flawed technical point of view. it's merely psychological way prevent people document you, author, not want.
it's stop sign on deserted road. says: should stop here, nobody/nothing going stop if no 1 around.
suggested approach: approach decrypt pdf using unethicalreading parameter, , @ permissions set. if permissions don't allow assembly, refuse document. set permissions on resulting pdf try find combination of permissions respect permissions set on original documents.
in cases, it's not hard: people don't know pdfs owners of documents forgot passwords used encrypt them. in case, simple permission of owners of documents sufficient decrypt them.
final remark: i'm original developer of itext , i'm responsible introducing unethicalreading parameter. i've chosen name unethicalreading make sure people aware of doing. doesn't mean using parameter unethical or illegal.
Comments
Post a Comment