sorry, maybe I miss something but I don't understand, do you mind to
use signedStream.ToArray() after st.close() ? I get the same
exception.



2006/10/24, Paulo Soares <[EMAIL PROTECTED]>:
> signedStream.ToArray()
>
> Paulo
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of mike mike
> > Sent: Tuesday, October 24, 2006 11:00 AM
> > To: [email protected]
> > Subject: [iText-questions] sign a file in memory, not in disk
> >
> > Hi,
> >
> > working with C# (.NET 2.0) and itextsharp (v 3.1.5) .
> >
> > The piece of code at the end of thos mail is to sign a file.
> >
> > When I sign a pdf and got the signed pdf into a file, it runs fine. (
> > as in the comment lines //xxx )
> >
> > But if I want to keep the signed file in a MemoryStream in place of a
> > FileStream, when the signature has been done (st.close()), my
> > MemoryStream no longer exists, it has been "disposed" and I get a
> >
> > System.ObjectDisposedException
> >
> > Is there an error in the code? or st.close() makes free the stream
> > provided and I cannot use it?
> >
> > Below the code:
> >
> > PdfReader reader = new PdfReader("filetosign.pdf");
> >
> > MemoryStream signedStream = new MemoryStream();
> > //xxx FileStream signedStream = new new FileStream("signedFile.pdf",
> > FileMode.Create, FileAccess.Write);
> >
> > //In the next instruction I use a Memory Stream in place of a
> > FileStream to get the result
> > PdfStamper st = PdfStamper.CreateSignature(reader,
> > signedStream, '\0',null);
> >
> > st.SetEncryption(PdfWriter.STRENGTH128BITS, null,"hello",
> > PdfWriter.AllowPrinting);
> > PdfSignatureAppearance sap = st.SignatureAppearance;
> >
> > sap.SetCrypto(this.myCert.Akp, this.myCert.Chain, null,
> > PdfSignatureAppearance.WINCER_SIGNED);
> >
> > sap.Reason = "x";
> > sap.Contact = "y";
> > sap.Location = "z";
> >
> > st.Close();
> >
> > //xxx FileStream signedStream = new new FileStream("signedFile.pdf",
> > FileMode.Open, FileAccess.Read);
> >
> > long numBytes = signedStream.Length; // HERE I GET THE EXCEPTION
> >
> > Thanks for your help.
> >
> > --------------------------------------------------------------
> > -----------
> > Using Tomcat but need to do more? Need to support web
> > services, security?
> > Get stuff done quickly with pre-integrated technology to make
> > your job easier
> > Download IBM WebSphere Application Server v.1.0.1 based on
> > Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&;
> > dat=121642
> > _______________________________________________
> > iText-questions mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
> >
>
>
> 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.
>
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to