|
View:
New views
16 Messages
—
Rating Filter:
Alert me
|
|
|
128-bit encryption, no owner passwordWe have an application that is creating a 128-bit encrypted PDF without user or owner passwords. When performing a PdfCopy.GetImportPage method call, the GetImportPage method fails in version 4.1.1.0. This worked in version 3.1.6.0.
The error might stem from the following: //this is the error being thrown because false is being returend from "IsOpenedWillFullPermissions". internal PdfImportedPage GetImportedPage(int pageNumber) { if (!reader.IsOpenedWithFullPermissions) throw new ArgumentException("PdfReader not opened with owner password"); //this method returns false if encrypted and no password is supplied. public bool IsOpenedWithFullPermissions { get { return !encrypted || ownerPasswordUsed; } } //this is the calling code Snippet one… if (reportGuid != Guid.Empty) { SQLFileInfo inputInfo = new SQLFileInfo(reportGuid); using (SQLFileStream inputStream = inputInfo.Open(System.IO.FileMode.Open)) { reader = new PdfReader(inputStream, null); if (copy == null) { doc = new Document(reader.GetPageSizeWithRotation(1)); copy = new PdfCopy(doc, outputStream); doc.Open(); } //copy the pages CopyPages(copy, reader); } } Snippet two… private void CopyPages(PdfCopy copy, PdfReader reader) { for (int i = 1; i <= reader.NumberOfPages; i++) { //This is where the error happens copy.AddPage(copy.GetImportedPage(reader, i)); } } |
|
|
Re: 128-bit encryption, no owner passwordThat's a legal imposition from Adobe. You must have the owner password.
Paulo > -----Original Message----- > From: itextsharp-questions-bounces@... > [mailto:itextsharp-questions-bounces@...] > On Behalf Of IT_Hank > Sent: Tuesday, May 13, 2008 4:00 PM > To: itextsharp-questions@... > Subject: [itextsharp-questions] 128-bit encryption, no owner password > > > We have an application that is creating a 128-bit encrypted > PDF without user > or owner passwords. When performing a PdfCopy.GetImportPage > method call, > the GetImportPage method fails in version 4.1.1.0. This > worked in version > 3.1.6.0. > > The error might stem from the following: > > //this is the error being thrown because false is being returend from > "IsOpenedWillFullPermissions". > > internal PdfImportedPage GetImportedPage(int pageNumber) { > if (!reader.IsOpenedWithFullPermissions) > throw new ArgumentException("PdfReader not > opened with owner > password"); > > //this method returns false if encrypted and no password is supplied. > > public bool IsOpenedWithFullPermissions { > get { > return !encrypted || ownerPasswordUsed; > } > } > > //this is the calling code > Snippet one... > if (reportGuid != Guid.Empty) > { > SQLFileInfo inputInfo = new SQLFileInfo(reportGuid); > using (SQLFileStream inputStream = > inputInfo.Open(System.IO.FileMode.Open)) > { > reader = new PdfReader(inputStream, null); > if (copy == null) > { > doc = new Document(reader.GetPageSizeWithRotation(1)); > copy = new PdfCopy(doc, outputStream); > doc.Open(); > } > //copy the pages > CopyPages(copy, reader); > } > } > > Snippet two... > private void CopyPages(PdfCopy copy, PdfReader reader) > { > for (int i = 1; i <= reader.NumberOfPages; i++) > { > //This is where the error happens > copy.AddPage(copy.GetImportedPage(reader, i)); > } > } Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: 128-bit encryption, no owner passwordHello Paulo,
I have been looking on the Adobe site for the license that indicates that a owner password is required on a PDF document ("legal imposition). I was wondering if you could point me to the correct license agreement that includes this text. I need to pass this on to our business leaders. Thank you, Kevin
|
|
|
Re: 128-bit encryption, no owner passwordFrom the PDF reference:
Authors of software that accepts input in the form of the Portable Document Format must make reasonable efforts to ensure that the software they create respects the access permissions and permissions controls listed in Table 3.20 of this specification, to the extent that they are used in any particular document. These access permissions express the rights that the document’s author has granted to users of the document. It is the responsibility of Portable Document Format consumer software to respect the author’s intent. Paulo ----- Original Message ----- From: "IT_Hank" <KHendricks@...> To: <itextsharp-questions@...> Sent: Friday, June 12, 2009 10:39 PM Subject: Re: [itextsharp-questions] 128-bit encryption, no owner password > > Hello Paulo, > > I have been looking on the Adobe site for the license that indicates that > a > owner password is required on a PDF document ("legal imposition). I was > wondering if you could point me to the correct license agreement that > includes this text. I need to pass this on to our business leaders. > > Thank you, > > Kevin > > > Paulo Soares wrote: >> >> That's a legal imposition from Adobe. You must have the owner password. >> >> Paulo >> >>> -----Original Message----- >>> From: itextsharp-questions-bounces@... >>> [mailto:itextsharp-questions-bounces@...] >>> On Behalf Of IT_Hank >>> Sent: Tuesday, May 13, 2008 4:00 PM >>> To: itextsharp-questions@... >>> Subject: [itextsharp-questions] 128-bit encryption, no owner password >>> >>> >>> We have an application that is creating a 128-bit encrypted >>> PDF without user >>> or owner passwords. When performing a PdfCopy.GetImportPage >>> method call, >>> the GetImportPage method fails in version 4.1.1.0. This >>> worked in version >>> 3.1.6.0. >>> >>> The error might stem from the following: >>> >>> //this is the error being thrown because false is being returend from >>> "IsOpenedWillFullPermissions". >>> >>> internal PdfImportedPage GetImportedPage(int pageNumber) { >>> if (!reader.IsOpenedWithFullPermissions) >>> throw new ArgumentException("PdfReader not >>> opened with owner >>> password"); >>> >>> //this method returns false if encrypted and no password is supplied. >>> >>> public bool IsOpenedWithFullPermissions { >>> get { >>> return !encrypted || ownerPasswordUsed; >>> } >>> } >>> >>> //this is the calling code >>> Snippet one... >>> if (reportGuid != Guid.Empty) >>> { >>> SQLFileInfo inputInfo = new SQLFileInfo(reportGuid); >>> using (SQLFileStream inputStream = >>> inputInfo.Open(System.IO.FileMode.Open)) >>> { >>> reader = new PdfReader(inputStream, null); >>> if (copy == null) >>> { >>> doc = new Document(reader.GetPageSizeWithRotation(1)); >>> copy = new PdfCopy(doc, outputStream); >>> doc.Open(); >>> } >>> //copy the pages >>> CopyPages(copy, reader); >>> } >>> } >>> >>> Snippet two... >>> private void CopyPages(PdfCopy copy, PdfReader reader) >>> { >>> for (int i = 1; i <= reader.NumberOfPages; i++) >>> { >>> //This is where the error happens >>> copy.AddPage(copy.GetImportedPage(reader, i)); >>> } >>> } ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: 128-bit encryption, no owner passwordThanks Paulo for the information.
-----Original Message----- From: Paulo Soares [mailto:psoares@...] Sent: Saturday, June 13, 2009 4:41 AM To: Post all your questions about iTextSharp here Subject: Re: [itextsharp-questions] 128-bit encryption, no owner password From the PDF reference: Authors of software that accepts input in the form of the Portable Document Format must make reasonable efforts to ensure that the software they create respects the access permissions and permissions controls listed in Table 3.20 of this specification, to the extent that they are used in any particular document. These access permissions express the rights that the document’s author has granted to users of the document. It is the responsibility of Portable Document Format consumer software to respect the author’s intent. Paulo ----- Original Message ----- From: "IT_Hank" <KHendricks@...> To: <itextsharp-questions@...> Sent: Friday, June 12, 2009 10:39 PM Subject: Re: [itextsharp-questions] 128-bit encryption, no owner password > > Hello Paulo, > > I have been looking on the Adobe site for the license that indicates that > a > owner password is required on a PDF document ("legal imposition). I was > wondering if you could point me to the correct license agreement that > includes this text. I need to pass this on to our business leaders. > > Thank you, > > Kevin > > > Paulo Soares wrote: >> >> That's a legal imposition from Adobe. You must have the owner password. >> >> Paulo >> >>> -----Original Message----- >>> From: itextsharp-questions-bounces@... >>> [mailto:itextsharp-questions-bounces@...] >>> On Behalf Of IT_Hank >>> Sent: Tuesday, May 13, 2008 4:00 PM >>> To: itextsharp-questions@... >>> Subject: [itextsharp-questions] 128-bit encryption, no owner password >>> >>> >>> We have an application that is creating a 128-bit encrypted >>> PDF without user >>> or owner passwords. When performing a PdfCopy.GetImportPage >>> method call, >>> the GetImportPage method fails in version 4.1.1.0. This >>> worked in version >>> 3.1.6.0. >>> >>> The error might stem from the following: >>> >>> //this is the error being thrown because false is being returend from >>> "IsOpenedWillFullPermissions". >>> >>> internal PdfImportedPage GetImportedPage(int pageNumber) { >>> if (!reader.IsOpenedWithFullPermissions) >>> throw new ArgumentException("PdfReader not >>> opened with owner >>> password"); >>> >>> //this method returns false if encrypted and no password is supplied. >>> >>> public bool IsOpenedWithFullPermissions { >>> get { >>> return !encrypted || ownerPasswordUsed; >>> } >>> } >>> >>> //this is the calling code >>> Snippet one... >>> if (reportGuid != Guid.Empty) >>> { >>> SQLFileInfo inputInfo = new SQLFileInfo(reportGuid); >>> using (SQLFileStream inputStream = >>> inputInfo.Open(System.IO.FileMode.Open)) >>> { >>> reader = new PdfReader(inputStream, null); >>> if (copy == null) >>> { >>> doc = new Document(reader.GetPageSizeWithRotation(1)); >>> copy = new PdfCopy(doc, outputStream); >>> doc.Open(); >>> } >>> //copy the pages >>> CopyPages(copy, reader); >>> } >>> } >>> >>> Snippet two... >>> private void CopyPages(PdfCopy copy, PdfReader reader) >>> { >>> for (int i = 1; i <= reader.NumberOfPages; i++) >>> { >>> //This is where the error happens >>> copy.AddPage(copy.GetImportedPage(reader, i)); >>> } >>> } ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: 128-bit encryption, no owner passwordHi Paulo, sorry to beat this to death, but I still couldn't find the referenced text in the latest PDF reference.
From your message, it seems to be indicating that developers of software like PDF readers should respect the passwords and encryptions of the PDF documents that they are reading. I don't see how this applys to iText and why iText should be required to automatically set the permissions password on generated PDF documents seeing these documents are being created and not consumed. And if it is the wish of the PDF authour not to set a permissions password, then consumers of that PDF will need to respect that as well. Thank you. Kevin
|
|
|
Re: 128-bit encryption, no owner passwordThe text applies to PDFs that are read. If you are producing docs you may or may not apply restrictions. You should probably contact Adobe's legal department about this if you still have doubts.
Paulo > -----Original Message----- > From: IT_Hank [mailto:KHendricks@...] > Sent: Friday, June 26, 2009 3:50 PM > To: itextsharp-questions@... > Subject: Re: [itextsharp-questions] 128-bit encryption, no > owner password > > > Hi Paulo, sorry to beat this to death, but I still couldn't find the > referenced text in the latest PDF reference. > > From your message, it seems to be indicating that developers > of software > like PDF readers should respect the passwords and encryptions > of the PDF > documents that they are reading. I don't see how this applys > to iText and > why iText should be required to automatically set the > permissions password > on generated PDF documents seeing these documents are being > created and not > consumed. And if it is the wish of the PDF authour not to > set a permissions > password, then consumers of that PDF will need to respect > that as well. > > Thank you. > > Kevin > > IT_Hank wrote: > > > > Thanks Paulo for the information. > > > > -----Original Message----- > > From: Paulo Soares [mailto:psoares@...] > > Sent: Saturday, June 13, 2009 4:41 AM > > To: Post all your questions about iTextSharp here > > Subject: Re: [itextsharp-questions] 128-bit encryption, no > owner password > > > > From the PDF reference: > > > > Authors of software that accepts input in the form of the Portable > > Document > > Format must make reasonable efforts to ensure that the software they > > create > > respects > > the access permissions and permissions controls listed in > Table 3.20 of > > this specification, to the extent that they are used in any > particular > > document. > > These access permissions express the rights that the > document's author has > > granted to users of the document. It is the responsibility > of Portable > > Document > > Format consumer software to respect the author's intent. > > > > Paulo > > > > ----- Original Message ----- > > From: "IT_Hank" <KHendricks@...> > > To: <itextsharp-questions@...> > > Sent: Friday, June 12, 2009 10:39 PM > > Subject: Re: [itextsharp-questions] 128-bit encryption, no > owner password > > > > > >> > >> Hello Paulo, > >> > >> I have been looking on the Adobe site for the license that > indicates that > >> a > >> owner password is required on a PDF document ("legal > imposition). I was > >> wondering if you could point me to the correct license > agreement that > >> includes this text. I need to pass this on to our > business leaders. > >> > >> Thank you, > >> > >> Kevin > >> > >> > >> Paulo Soares wrote: > >>> > >>> That's a legal imposition from Adobe. You must have the > owner password. > >>> > >>> Paulo > >>> > >>>> -----Original Message----- > >>>> From: itextsharp-questions-bounces@... > >>>> [mailto:itextsharp-questions-bounces@...] > >>>> On Behalf Of IT_Hank > >>>> Sent: Tuesday, May 13, 2008 4:00 PM > >>>> To: itextsharp-questions@... > >>>> Subject: [itextsharp-questions] 128-bit encryption, no > owner password > >>>> > >>>> > >>>> We have an application that is creating a 128-bit encrypted > >>>> PDF without user > >>>> or owner passwords. When performing a PdfCopy.GetImportPage > >>>> method call, > >>>> the GetImportPage method fails in version 4.1.1.0. This > >>>> worked in version > >>>> 3.1.6.0. > >>>> > >>>> The error might stem from the following: > >>>> > >>>> //this is the error being thrown because false is being > returend from > >>>> "IsOpenedWillFullPermissions". > >>>> > >>>> internal PdfImportedPage GetImportedPage(int > pageNumber) { > >>>> if (!reader.IsOpenedWithFullPermissions) > >>>> throw new ArgumentException("PdfReader not > >>>> opened with owner > >>>> password"); > >>>> > >>>> //this method returns false if encrypted and no password > is supplied. > >>>> > >>>> public bool IsOpenedWithFullPermissions { > >>>> get { > >>>> return !encrypted || ownerPasswordUsed; > >>>> } > >>>> } > >>>> > >>>> //this is the calling code > >>>> Snippet one... > >>>> if (reportGuid != Guid.Empty) > >>>> { > >>>> SQLFileInfo inputInfo = new SQLFileInfo(reportGuid); > >>>> using (SQLFileStream inputStream = > >>>> inputInfo.Open(System.IO.FileMode.Open)) > >>>> { > >>>> reader = new PdfReader(inputStream, null); > >>>> if (copy == null) > >>>> { > >>>> doc = new > Document(reader.GetPageSizeWithRotation(1)); > >>>> copy = new PdfCopy(doc, outputStream); > >>>> doc.Open(); > >>>> } > >>>> //copy the pages > >>>> CopyPages(copy, reader); > >>>> } > >>>> } > >>>> > >>>> Snippet two... > >>>> private void CopyPages(PdfCopy copy, PdfReader reader) > >>>> { > >>>> for (int i = 1; i <= reader.NumberOfPages; i++) > >>>> { > >>>> //This is where the error happens > >>>> copy.AddPage(copy.GetImportedPage(reader, i)); > >>>> } > >>>> } Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------------ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: 128-bit encryption, no owner passwordThanks Paulo, but that is what I mean. iText applies the permissions password automatically if the permissions password is not provided by the PDF creator, as is done in Acrobat. I find nothing that states that this needs to be the case. Only the reader of the document needs to respect the permissions and passwords (no cracking).
You are correct, I will need to contact Adobe Legal, maybe they will respond in 9 months or so. :-) I assume you need a password (owner or user) for a document to be encrypted? The ideal is to have a password protected, non-encrypted document. The reason is that we have run across a piece of software that when a user trys to forward an email with one of our PDFs (encrypted/permission password protected), the email security tries to encrypt the email, but this fails becuase of the encrypted PDF. Just trying to get around that. Thanks Paulo for all that you do. Kevin
|
|
|
Re: 128-bit encryption, no owner passwordThanks Paulo, but that is what I mean. iText applies the permissions password automatically if the permissions password is not provided by the PDF creator, as is done in Acrobat. I find nothing that states that this needs to be the case. Only the reader of the document needs to respect the permissions and passwords (no cracking).
You are correct, I will need to contact Adobe Legal, maybe they will respond in 9 months or so. :-) I assume you need a password (owner or user) for a document to be encrypted? The ideal is to have a password protected, non-encrypted document. The reason is that we have run across a piece of software that when a user trys to forward an email with one of our PDFs (encrypted/permission password protected), the email security tries to encrypt the email, but this fails becuase of the encrypted PDF. Just trying to get around that. Thanks Paulo for all that you do. Kevin
|
|
|
Re: 128-bit encryption, no owner passwordWe can be here forever talking about what you would like to happen and what
iText does and why it must do it. You may post your questions in the iText mailing list where Leonard Rosenthal from Adobe can give you a semi-oficial answer. Paulo ----- Original Message ----- From: "IT_Hank" <KHendricks@...> To: <itextsharp-questions@...> Sent: Friday, June 26, 2009 5:01 PM Subject: Re: [itextsharp-questions] 128-bit encryption, no owner password > > Thanks Paulo, but that is what I mean. iText applies the permissions > password automatically if the permissions password is not provided by the > PDF creator, as is done in Acrobat. I find nothing that states that this > needs to be the case. Only the reader of the document needs to respect > the > permissions and passwords (no cracking). > > You are correct, I will need to contact Adobe Legal, maybe they will > respond > in 9 months or so. :-) > > I assume you need a password (owner or user) for a document to be > encrypted? > The ideal is to have a password protected, non-encrypted document. The > reason is that we have run across a piece of software that when a user > trys > to forward an email with one of our PDFs (encrypted/permission password > protected), the email security tries to encrypt the email, but this fails > becuase of the encrypted PDF. Just trying to get around that. > > Thanks Paulo for all that you do. > > Kevin > > > > Paulo Soares-3 wrote: >> >> The text applies to PDFs that are read. If you are producing docs you may >> or may not apply restrictions. You should probably contact Adobe's legal >> department about this if you still have doubts. >> >> Paulo >> >>> -----Original Message----- >>> From: IT_Hank [mailto:KHendricks@...] >>> Sent: Friday, June 26, 2009 3:50 PM >>> To: itextsharp-questions@... >>> Subject: Re: [itextsharp-questions] 128-bit encryption, no >>> owner password >>> >>> >>> Hi Paulo, sorry to beat this to death, but I still couldn't find the >>> referenced text in the latest PDF reference. >>> >>> From your message, it seems to be indicating that developers >>> of software >>> like PDF readers should respect the passwords and encryptions >>> of the PDF >>> documents that they are reading. I don't see how this applys >>> to iText and >>> why iText should be required to automatically set the >>> permissions password >>> on generated PDF documents seeing these documents are being >>> created and not >>> consumed. And if it is the wish of the PDF authour not to >>> set a permissions >>> password, then consumers of that PDF will need to respect >>> that as well. >>> >>> Thank you. >>> >>> Kevin >>> >>> IT_Hank wrote: >>> > >>> > Thanks Paulo for the information. >>> > >>> > -----Original Message----- >>> > From: Paulo Soares [mailto:psoares@...] >>> > Sent: Saturday, June 13, 2009 4:41 AM >>> > To: Post all your questions about iTextSharp here >>> > Subject: Re: [itextsharp-questions] 128-bit encryption, no >>> owner password >>> > >>> > From the PDF reference: >>> > >>> > Authors of software that accepts input in the form of the Portable >>> > Document >>> > Format must make reasonable efforts to ensure that the software they >>> > create >>> > respects >>> > the access permissions and permissions controls listed in >>> Table 3.20 of >>> > this specification, to the extent that they are used in any >>> particular >>> > document. >>> > These access permissions express the rights that the >>> document's author has >>> > granted to users of the document. It is the responsibility >>> of Portable >>> > Document >>> > Format consumer software to respect the author's intent. >>> > >>> > Paulo >>> > >>> > ----- Original Message ----- >>> > From: "IT_Hank" <KHendricks@...> >>> > To: <itextsharp-questions@...> >>> > Sent: Friday, June 12, 2009 10:39 PM >>> > Subject: Re: [itextsharp-questions] 128-bit encryption, no >>> owner password >>> > >>> > >>> >> >>> >> Hello Paulo, >>> >> >>> >> I have been looking on the Adobe site for the license that >>> indicates that >>> >> a >>> >> owner password is required on a PDF document ("legal >>> imposition). I was >>> >> wondering if you could point me to the correct license >>> agreement that >>> >> includes this text. I need to pass this on to our >>> business leaders. >>> >> >>> >> Thank you, >>> >> >>> >> Kevin >>> >> >>> >> >>> >> Paulo Soares wrote: >>> >>> >>> >>> That's a legal imposition from Adobe. You must have the >>> owner password. >>> >>> >>> >>> Paulo >>> >>> >>> >>>> -----Original Message----- >>> >>>> From: itextsharp-questions-bounces@... >>> >>>> [mailto:itextsharp-questions-bounces@...] >>> >>>> On Behalf Of IT_Hank >>> >>>> Sent: Tuesday, May 13, 2008 4:00 PM >>> >>>> To: itextsharp-questions@... >>> >>>> Subject: [itextsharp-questions] 128-bit encryption, no >>> owner password >>> >>>> >>> >>>> >>> >>>> We have an application that is creating a 128-bit encrypted >>> >>>> PDF without user >>> >>>> or owner passwords. When performing a PdfCopy.GetImportPage >>> >>>> method call, >>> >>>> the GetImportPage method fails in version 4.1.1.0. This >>> >>>> worked in version >>> >>>> 3.1.6.0. >>> >>>> >>> >>>> The error might stem from the following: >>> >>>> >>> >>>> //this is the error being thrown because false is being >>> returend from >>> >>>> "IsOpenedWillFullPermissions". >>> >>>> >>> >>>> internal PdfImportedPage GetImportedPage(int >>> pageNumber) { >>> >>>> if (!reader.IsOpenedWithFullPermissions) >>> >>>> throw new ArgumentException("PdfReader not >>> >>>> opened with owner >>> >>>> password"); >>> >>>> >>> >>>> //this method returns false if encrypted and no password >>> is supplied. >>> >>>> >>> >>>> public bool IsOpenedWithFullPermissions { >>> >>>> get { >>> >>>> return !encrypted || ownerPasswordUsed; >>> >>>> } >>> >>>> } >>> >>>> >>> >>>> //this is the calling code >>> >>>> Snippet one... >>> >>>> if (reportGuid != Guid.Empty) >>> >>>> { >>> >>>> SQLFileInfo inputInfo = new SQLFileInfo(reportGuid); >>> >>>> using (SQLFileStream inputStream = >>> >>>> inputInfo.Open(System.IO.FileMode.Open)) >>> >>>> { >>> >>>> reader = new PdfReader(inputStream, null); >>> >>>> if (copy == null) >>> >>>> { >>> >>>> doc = new >>> Document(reader.GetPageSizeWithRotation(1)); >>> >>>> copy = new PdfCopy(doc, outputStream); >>> >>>> doc.Open(); >>> >>>> } >>> >>>> //copy the pages >>> >>>> CopyPages(copy, reader); >>> >>>> } >>> >>>> } >>> >>>> >>> >>>> Snippet two... >>> >>>> private void CopyPages(PdfCopy copy, PdfReader reader) >>> >>>> { >>> >>>> for (int i = 1; i <= reader.NumberOfPages; i++) >>> >>>> { >>> >>>> //This is where the error happens >>> >>>> copy.AddPage(copy.GetImportedPage(reader, i)); >>> >>>> } >>> >>>> } ------------------------------------------------------------------------------ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
How to rotate a PDF fileHi,
I want to rotate all pages inside a PDF file with 90,180 or 270 degrees. Is it possible with iTextSharp? Thanks, Ben This message and attachment(s) are intended solely for use by the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone and with a 'reply' message. Thank you for your co-operation. ------------------------------------------------------------------------------ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: How to rotate a PDF filePdfReader r = new PdfReader(...);
for (int k = 1; k <= r.NumberOfPages; ++k) { PdfDictionary page = r.GetPageN(k); page.Put(PdfName.ROTATE, new PdfNumber(90)); } PdfStamper stp = new PdfStamper(r, ...); stp.Close(); Paulo > -----Original Message----- > From: Erp van, Ben [mailto:ben.vanerp@...] > Sent: Monday, June 29, 2009 10:56 AM > To: Post all your questions about iTextSharp here > Subject: [itextsharp-questions] How to rotate a PDF file > > Hi, > > I want to rotate all pages inside a PDF file with 90,180 or > 270 degrees. > Is it possible with iTextSharp? > > Thanks, Ben Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------------ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: How to rotate a PDF fileHi Paulo,
Thanks, i forgot stp.Close(). Unfortunatly i'm not ready yet. I need to convert the rotated document to the PDF/A standard but after doing this the original rotation is restored. Is this a know problem? Thanks, Ben -----Original Message----- From: Paulo Soares [mailto:psoares@...] Sent: maandag 29 juni 2009 12:43 To: Post all your questions about iTextSharp here Subject: Re: [itextsharp-questions] How to rotate a PDF file PdfReader r = new PdfReader(...); for (int k = 1; k <= r.NumberOfPages; ++k) { PdfDictionary page = r.GetPageN(k); page.Put(PdfName.ROTATE, new PdfNumber(90)); } PdfStamper stp = new PdfStamper(r, ...); stp.Close(); Paulo > -----Original Message----- > From: Erp van, Ben [mailto:ben.vanerp@...] > Sent: Monday, June 29, 2009 10:56 AM > To: Post all your questions about iTextSharp here > Subject: [itextsharp-questions] How to rotate a PDF file > > Hi, > > I want to rotate all pages inside a PDF file with 90,180 or 270 > degrees. > Is it possible with iTextSharp? > > Thanks, Ben Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. This message and attachment(s) are intended solely for use by the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone and with a 'reply' message. Thank you for your co-operation. ------------------------------------------------------------------------------ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: How to rotate a PDF fileThere's nothing in the PDF/A standard about restricting the page rotation. Where does your PDF/A conversion program gets the original rotation from or does it just erase the key (setting it to 0)?
Paulo > -----Original Message----- > From: Erp van, Ben [mailto:ben.vanerp@...] > Sent: Monday, June 29, 2009 11:54 AM > To: Post all your questions about iTextSharp here > Subject: Re: [itextsharp-questions] How to rotate a PDF file > > Hi Paulo, > > Thanks, i forgot stp.Close(). > > Unfortunatly i'm not ready yet. I need to convert the rotated > document to the PDF/A standard but after doing this the > original rotation is restored. > Is this a know problem? > > Thanks, Ben > > > > > -----Original Message----- > From: Paulo Soares [mailto:psoares@...] > Sent: maandag 29 juni 2009 12:43 > To: Post all your questions about iTextSharp here > Subject: Re: [itextsharp-questions] How to rotate a PDF file > > PdfReader r = new PdfReader(...); > for (int k = 1; k <= r.NumberOfPages; ++k) { > PdfDictionary page = r.GetPageN(k); > page.Put(PdfName.ROTATE, new PdfNumber(90)); } PdfStamper > stp = new PdfStamper(r, ...); stp.Close(); > > Paulo > > > -----Original Message----- > > From: Erp van, Ben [mailto:ben.vanerp@...] > > Sent: Monday, June 29, 2009 10:56 AM > > To: Post all your questions about iTextSharp here > > Subject: [itextsharp-questions] How to rotate a PDF file > > > > Hi, > > > > I want to rotate all pages inside a PDF file with 90,180 or 270 > > degrees. > > Is it possible with iTextSharp? > > > > Thanks, Ben Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------------ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: How to rotate a PDF fileI use this code for conversion to PDF/A:
PdfReader pdfReader = new PdfReader(Scans[0].ToString()); iTextSharp.text.Rectangle docSize = pdfReader.GetPageSize(1); Document doc = new Document(docSize); PdfWriter pdfWriter = PdfWriter.GetInstance(doc, new FileStream(tempFile, FileMode.Create)); if (_pdfAType == 0) { pdfWriter.PDFXConformance = PdfWriter.PDFA1A; } if (_pdfAType == 1) { pdfWriter.PDFXConformance = PdfWriter.PDFA1B; } doc.Open(); PdfContentByte pdfContentByte = pdfWriter.DirectContent; PdfDictionary pdfDic = new PdfDictionary(PdfName.OUTPUTINTENT); pdfDic.Put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("sRGB IEC61966-2.1")); pdfDic.Put(PdfName.INFO, new PdfString("sRGB IEC61966-2.1")); pdfDic.Put(PdfName.S, PdfName.GTS_PDFA1); ICC_Profile icc = ICC_Profile.GetInstance(Path.GetDirectoryName(Application.ExecutablePath) + \\srgb.profile); PdfICCBased ib = new PdfICCBased(icc); ib.Remove(PdfName.ALTERNATE); pdfDic.Put(PdfName.DESTOUTPUTPROFILE, pdfWriter.AddToBody(ib).IndirectReference); pdfWriter.ExtraCatalog.Put(PdfName.OUTPUTINTENTS, new PdfArray(pdfDic)); if (_pdfAType == 0) { PdfDictionary markInfo = new PdfDictionary(PdfName.MARKINFO); markInfo.Put(PdfName.MARKED, new PdfBoolean(true)); pdfWriter.ExtraCatalog.Put(PdfName.MARKINFO, markInfo); } PdfImportedPage importedPage = pdfWriter.GetImportedPage(pdfReader, 1); pdfContentByte.AddTemplate(importedPage, 0, 0); doc.AddTitle(Path.GetFileName(Scans[0].ToString())); doc.AddCreator("PDF-A Conv"); pdfWriter.CreateXmpMetadata(); doc.Close(); Regards, Ben -----Original Message----- From: Paulo Soares [mailto:psoares@...] Sent: maandag 29 juni 2009 13:30 To: Post all your questions about iTextSharp here Subject: Re: [itextsharp-questions] How to rotate a PDF file There's nothing in the PDF/A standard about restricting the page rotation. Where does your PDF/A conversion program gets the original rotation from or does it just erase the key (setting it to 0)? Paulo > -----Original Message----- > From: Erp van, Ben [mailto:ben.vanerp@...] > Sent: Monday, June 29, 2009 11:54 AM > To: Post all your questions about iTextSharp here > Subject: Re: [itextsharp-questions] How to rotate a PDF file > > Hi Paulo, > > Thanks, i forgot stp.Close(). > > Unfortunatly i'm not ready yet. I need to convert the rotated document > to the PDF/A standard but after doing this the original rotation is > restored. > Is this a know problem? > > Thanks, Ben > > > > > -----Original Message----- > From: Paulo Soares [mailto:psoares@...] > Sent: maandag 29 juni 2009 12:43 > To: Post all your questions about iTextSharp here > Subject: Re: [itextsharp-questions] How to rotate a PDF file > > PdfReader r = new PdfReader(...); > for (int k = 1; k <= r.NumberOfPages; ++k) { > PdfDictionary page = r.GetPageN(k); > page.Put(PdfName.ROTATE, new PdfNumber(90)); } PdfStamper stp = new > PdfStamper(r, ...); stp.Close(); > > Paulo > > > -----Original Message----- > > From: Erp van, Ben [mailto:ben.vanerp@...] > > Sent: Monday, June 29, 2009 10:56 AM > > To: Post all your questions about iTextSharp here > > Subject: [itextsharp-questions] How to rotate a PDF file > > > > Hi, > > > > I want to rotate all pages inside a PDF file with 90,180 or 270 > > degrees. > > Is it possible with iTextSharp? > > > > Thanks, Ben Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. This message and attachment(s) are intended solely for use by the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone and with a 'reply' message. Thank you for your co-operation. ------------------------------------------------------------------------------ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: How to rotate a PDF fileHi Paulo,
This is the complete code is use for rotation and conversion: string tempFile = Path.GetTempFileName(); #region Rotation string tempPdf = Path.GetTempFileName(); PdfReader reader = new PdfReader(Scans[0].ToString()); for (int k = 1; k < reader.NumberOfPages+1; k++) { PdfDictionary page = reader.GetPageN(k); page.Put(PdfName.ROTATE, new PdfNumber(90)); } FileStream os = new FileStream(tempPdf,FileMode.Create,FileAccess.Write); PdfStamper stp = new PdfStamper(reader, os); stp.Close(); os.Close(); #endregion string outputFile = Path.GetFileName(Scans[0].ToString()); PdfReader pdfReader = new PdfReader(tempPdf); iTextSharp.text.Rectangle docSize = pdfReader.GetPageSizeWithRotation(1); Document doc = new Document(docSize); PdfWriter pdfWriter = PdfWriter.GetInstance(doc, new FileStream(tempFile, FileMode.Create)); if (_pdfAType == 0) { pdfWriter.PDFXConformance = PdfWriter.PDFA1A; } if (_pdfAType == 1) { pdfWriter.PDFXConformance = PdfWriter.PDFA1B; } doc.Open(); PdfContentByte pdfContentByte = pdfWriter.DirectContent; PdfDictionary outi = new PdfDictionary(PdfName.OUTPUTINTENT); outi.Put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("sRGB IEC61966-2.1")); outi.Put(PdfName.INFO, new PdfString("sRGB IEC61966-2.1")); outi.Put(PdfName.S, PdfName.GTS_PDFA1); ICC_Profile icc = ICC_Profile.GetInstance(Path.GetDirectoryName(Application.ExecutablePath) + "\\srgb.profile"); PdfICCBased ib = new PdfICCBased(icc); ib.Remove(PdfName.ALTERNATE); outi.Put(PdfName.DESTOUTPUTPROFILE, pdfWriter.AddToBody(ib).IndirectReference); pdfWriter.ExtraCatalog.Put(PdfName.OUTPUTINTENTS, new PdfArray(outi)); if (_pdfAType == 0) { PdfDictionary markInfo = new PdfDictionary(PdfName.MARKINFO); markInfo.Put(PdfName.MARKED, new PdfBoolean(true)); pdfWriter.ExtraCatalog.Put(PdfName.MARKINFO, markInfo); } PdfImportedPage importedPage = pdfWriter.GetImportedPage(pdfReader, 1); pdfContentByte.AddTemplate(importedPage, importedPage.BoundingBox.Left, importedPage.BoundingBox.Bottom); doc.AddTitle(Path.GetFileName(Scans[0].ToString())); pdfWriter.CreateXmpMetadata(); doc.Close(); pdfWriter.Close(); File.Delete(Scans[0].ToString()); Scans.RemoveAt(0); File.Copy(tempFile, "c:\\pdfa.pdf",true); Best regards, Ben -----Original Message----- From: Paulo Soares [mailto:psoares@...] Sent: maandag 29 juni 2009 13:30 To: Post all your questions about iTextSharp here Subject: Re: [itextsharp-questions] How to rotate a PDF file There's nothing in the PDF/A standard about restricting the page rotation. Where does your PDF/A conversion program gets the original rotation from or does it just erase the key (setting it to 0)? Paulo > -----Original Message----- > From: Erp van, Ben [mailto:ben.vanerp@...] > Sent: Monday, June 29, 2009 11:54 AM > To: Post all your questions about iTextSharp here > Subject: Re: [itextsharp-questions] How to rotate a PDF file > > Hi Paulo, > > Thanks, i forgot stp.Close(). > > Unfortunatly i'm not ready yet. I need to convert the rotated document > to the PDF/A standard but after doing this the original rotation is > restored. > Is this a know problem? > > Thanks, Ben > > > > > -----Original Message----- > From: Paulo Soares [mailto:psoares@...] > Sent: maandag 29 juni 2009 12:43 > To: Post all your questions about iTextSharp here > Subject: Re: [itextsharp-questions] How to rotate a PDF file > > PdfReader r = new PdfReader(...); > for (int k = 1; k <= r.NumberOfPages; ++k) { > PdfDictionary page = r.GetPageN(k); > page.Put(PdfName.ROTATE, new PdfNumber(90)); } PdfStamper stp = new > PdfStamper(r, ...); stp.Close(); > > Paulo > > > -----Original Message----- > > From: Erp van, Ben [mailto:ben.vanerp@...] > > Sent: Monday, June 29, 2009 10:56 AM > > To: Post all your questions about iTextSharp here > > Subject: [itextsharp-questions] How to rotate a PDF file > > > > Hi, > > > > I want to rotate all pages inside a PDF file with 90,180 or 270 > > degrees. > > Is it possible with iTextSharp? > > > > Thanks, Ben Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. This message and attachment(s) are intended solely for use by the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone and with a 'reply' message. Thank you for your co-operation. ------------------------------------------------------------------------------ _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
| Free embeddable forum powered by Nabble | Forum Help |