THBPdf Download Contact Us Buy Online Developerse-mail me

ITEXTSHARP PDFREADER to open secured file




Message-ID:<0420e52e-0bca-4634-8fcc-b508e755bc8b@x9g2000yqk.googlegroups.com>
Subject:

ITEXTSHARP PDFREADER to open secured file


Date:Fri, 20 Feb 2009 21:16:55 +0100


I am new to ITEXTSHARP.  I have code that was working until we secured
the PDF files against edits.

I need to open a secured PDF with PDFREADER, use stamper, then secure
the output to ASP.NET VB.  I have the username and password.

How do I do that?

Thanks,   Jim




Message-ID:<49a113a5$0$2855$ba620e4c@news.skynet.be>
Subject:

Re: ITEXTSHARP PDFREADER to open secured file


Date:Sun, 22 Feb 2009 09:58:13 +0100


ndpace wrote:
> I am new to ITEXTSHARP.  I have code that was working until we secured
> the PDF files against edits.
> 
> I need to open a secured PDF with PDFREADER, use stamper, then secure
> the output to ASP.NET VB.  I have the username and password.

PDFs don't have a username, do they?

> How do I do that?

You have to provide the owner password when constructing the reader object.




Message-ID:<97a5b77c-41d4-41f9-99c7-7fa491ac68c5@p13g2000yqc.googlegroups.com>
Subject:

Re: ITEXTSHARP PDFREADER to open secured file


Date:Mon, 23 Feb 2009 17:27:11 +0100


Sorry you are correct, I just meant password.
This is what I have tried:
Dim password() As Byte
password =3D System.Text.Encoding.Unicode.GetBytes("the_file_password")
Dim reader as PdfReader =3D new PdfReader(filename, password)

I get an error :
value of type '1-dimensional array of byte' cannot be converted to
'byte'

I am new to ASP.NET and ITEXTSHARP so any help would be great

Thanks,    Jim

On Feb 22, 12:58=A0am, Bruno Lowagie <br...@nospam.lowagie.com> wrote:
> ndpace wrote:
> > I am new to ITEXTSHARP. =A0I have code that was working until we secure=
d
> > the PDF files against edits.
>
> > I need to open a secured PDF with PDFREADER, use stamper, then secure
> > the output to ASP.NET VB. =A0I have the username and password.
>
> PDFs don't have a username, do they?
>
> > How do I do that?
>
> You have to provide the owner password when constructing the reader objec=
t.





Message-ID:<49a2d51e$0$2870$ba620e4c@news.skynet.be>
Subject:

Re: ITEXTSHARP PDFREADER to open secured file


Date:Mon, 23 Feb 2009 17:55:56 +0100


ndpace wrote:
> Sorry you are correct, I just meant password.
> This is what I have tried:
> Dim password() As Byte
> password = System.Text.Encoding.Unicode.GetBytes("the_file_password")
> Dim reader as PdfReader = new PdfReader(filename, password)
> 
> I get an error :
> value of type '1-dimensional array of byte' cannot be converted to
> 'byte'

I don't know C# well enough, but if this were Java, I think this would 
be some kind of ClassCastException. The error message tells you that 
"1-dimensional array of byte" is not the same type of class as a "byte". 
You have to adapt your code accordingly.




Message-ID:<9b690d81-f7e2-4904-ba4b-40f35d1ee8a3@f20g2000yqg.googlegroups.com>
Subject:

Re: ITEXTSHARP PDFREADER to open secured file


Date:Mon, 23 Feb 2009 19:16:03 +0100


I got this to work (I was missing the () in the DIM statement

Now it says I have a bad password, which I do not (confirmed in
Acrobat)

Do you think it is a conversion issue?

Thanks,     Jim


On Feb 23, 8:55=A0am, Bruno Lowagie <br...@nospam.lowagie.com> wrote:
> ndpace wrote:
> > Sorry you are correct, I just meant password.
> > This is what I have tried:
> > Dim password() As Byte
> > password =3D System.Text.Encoding.Unicode.GetBytes("the_file_password")
> > Dim reader as PdfReader =3D new PdfReader(filename, password)
>
> > I get an error :
> > value of type '1-dimensional array of byte' cannot be converted to
> > 'byte'
>
> I don't know C# well enough, but if this were Java, I think this would
> be some kind of ClassCastException. The error message tells you that
> "1-dimensional array of byte" is not the same type of class as a "byte".
> You have to adapt your code accordingly.





Message-ID:<d9626ba1-e683-4d2c-826a-97dc1ca7c962@t3g2000yqa.googlegroups.com>
Subject:

Re: ITEXTSHARP PDFREADER to open secured file


Date:Mon, 23 Feb 2009 22:11:27 +0100


On Feb 23, 10:16=A0am, ndpace <ndp...@gmail.com> wrote:
> I got this to work (I was missing the () in the DIM statement
>
> Now it says I have a bad password, which I do not (confirmed in
> Acrobat)
>
> Do you think it is a conversion issue?
>
> Thanks, =A0 =A0 Jim
>
> On Feb 23, 8:55=A0am, Bruno Lowagie <br...@nospam.lowagie.com> wrote:
>
>
>
> > ndpace wrote:
> > > Sorry you are correct, I just meant password.
> > > This is what I have tried:
> > > Dim password() As Byte
> > > password =3D System.Text.Encoding.Unicode.GetBytes("the_file_password=
")
> > > Dim reader as PdfReader =3D new PdfReader(filename, password)
>
> > > I get an error :
> > > value of type '1-dimensional array of byte' cannot be converted to
> > > 'byte'
>
> > I don't know C# well enough, but if this were Java, I think this would
> > be some kind of ClassCastException. The error message tells you that
> > "1-dimensional array of byte" is not the same type of class as a "byte"=
.
> > You have to adapt your code accordingly.- Hide quoted text -
>
> - Show quoted text -

Solved it, it needed to be ASCII not unicode for the password
jim




 

|THBPdf| |Download| |Developers|