Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
JSP - A mailing list about Java Server Pages specification and reference
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Adding a signature to an encrypted pdfdocument.

Adding a signature to an encrypted pdfdocument.

2006-07-12       - By Paulo Soares

 Back
It's a porting bug. In PdfEncryption.cs replace:

public PdfEncryption(PdfEncryption enc) : base() {

with

public PdfEncryption(PdfEncryption enc) : this() {

Paulo

> -- --Original Message-- --
> From: itext-questions-bounces@(protected)
> [mailto:itext-questions-bounces@(protected)] On
> Behalf Of David Saier
> Sent: Wednesday, July 12, 2006 3:03 PM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Adding a signature to an
> encrypted pdfdocument.
>
> Hi,
>  
> Thanks for the reply, this is the stack trace I get from the
> exception:
> System.NullReferenceException was unhandled
> Message="Object reference not set to an instance of an object."
> Source="iTextSharpSign"
> StackTrace:
> at iTextSharpSign.PDFSigner.Sign(String SigReason, String
> SigContact, String SigLocation, Boolean visible) in
> D:\Documents\PDFcreator\PDFcreator\iTextSharpSign\PDFSigner.cs
> :line 298
> at iTextSharpSign.Form1.button1_Click(Object sender,
> EventArgs e) in
> D:\Documents\PDFcreator\PDFcreator\iTextSharpSign\Form1.cs:line 109
> at System.Windows.Forms.Control.OnClick(EventArgs e)
> at System.Windows.Forms.Button.OnClick(EventArgs e)
> at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
> at System.Windows.Forms.Control.WmMouseUp(Message& m,
> MouseButtons button, Int32 clicks)
> at System.Windows.Forms.Control.WndProc(Message& m)
> at System.Windows.Forms.ButtonBase.WndProc(Message& m)
> at System.Windows.Forms.Button.WndProc(Message& m)
> at
> System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
> at
> System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
> at
> System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
> hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
> at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
> at
> System.Windows.Forms.Application.ComponentManager.System.Windo
> ws.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessage
> Loop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
> at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoopI
> nner(Int32 reason, ApplicationContext context)
> at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoop(
> Int32 reason, ApplicationContext context)
> at System.Windows.Forms.Application.Run(Form mainForm)
> at iTextSharpSign.Program.Main() in
> D:\Documents\PDFcreator\PDFcreator\iTextSharpSign\Program.cs:line 17
> at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
> at System.AppDomain.ExecuteAssembly(String assemblyFile,
> Evidence assemblySecurity, String[] args)
> at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
> at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
> at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
> at System.Threading.ThreadHelper.ThreadStart()
>  
> I didn't think that this was particularly useful so I found
> the exact line that was causing the exception. The line is in
> the SetHashKey Method in PdfEncryption.cs:
>  
> md5.Initialize();
> ...
>  
> This can be traced back up to PdfStamper.Close() method.
> I put a break point at this line and got the stack calls at
> that point:
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfEncryption.SetHashKe
> y(int number = 38, int generation = 0) Line 293
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfIndirectObject.PdfIn
> directObject(int number = 38, int generation = 0,
> iTextSharp.text.pdf.PdfObject objecti = {Dictionary of type:
> /XObject}, iTextSharp.text.pdf.PdfWriter writer =
> {iTextSharp.text.pdf.PdfStamperImp}) Line 119 + 0xe bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfIndirectObject.PdfIn
> directObject(int number = 38, iTextSharp.text.pdf.PdfObject
> objecti = {Dictionary of type: /XObject},
> iTextSharp.text.pdf.PdfWriter writer =
> {iTextSharp.text.pdf.PdfStamperImp}) Line 97 + 0x11 bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfWriter.PdfBody.Add(i
> TextSharp.text.pdf.PdfObject objecta = {Dictionary of type:
> /XObject}, int refNumber = 38, bool inObjStm = true) Line 355
> + 0x1c bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfWriter.PdfBody.Add(i
> TextSharp.text.pdf.PdfObject objecta = {Dictionary of type:
> /XObject}, int refNumber = 38) Line 343 + 0xe bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfWriter.PdfBody.Add(i
> TextSharp.text.pdf.PdfObject objecta = {Dictionary of type:
> /XObject}) Line 292 + 0x1b bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfWriter.AddToBody(iTe
> xtSharp.text.pdf.PdfObject objecta = {Dictionary of type:
> /XObject}) Line 1866 + 0xc bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfWriter.Add(iTextShar
> p.text.pdf.PdfImage pdfImage = {Dictionary of type:
> /XObject}, iTextSharp.text.pdf.PdfIndirectReference fixedRef
> = null) Line 991 + 0xa bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfWriter.AddDirectImag
> eSimple(iTextSharp.text.Image image = {Rectangle: 125x35
> (rot: 0 degrees)}, iTextSharp.text.pdf.PdfIndirectReference
> fixedRef = null) Line 967 + 0x11 bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfWriter.AddDirectImag
> eSimple(iTextSharp.text.Image image = {Rectangle: 125x35
> (rot: 0 degrees)}) Line 905 + 0xb bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfContentByte.AddImage
> (iTextSharp.text.Image image = {Rectangle: 125x35 (rot: 0
> degrees)}, float a = 250.0, float b = 0.0, float c = 0.0,
> float d = 75.0, float e = 0.0, float f = 0.0, bool
> inlineImage = false) Line 1211 + 0x10 bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfContentByte.AddImage
> (iTextSharp.text.Image image = {Rectangle: 125x35 (rot: 0
> degrees)}, float a = 250.0, float b = 0.0, float c = 0.0,
> float d = 75.0, float e = 0.0, float f = 0.0) Line 1133 + 0x1d bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfSignatureAppearance.
> GetAppearance() Line 329 + 0x79 bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfSignatureAppearance.
> PreClose(System.Collections.Hashtable exclusionSizes = null)
> Line 732 + 0x11 bytes
>  
> iTextSharpSign.exe!iTextSharp.text.pdf.PdfSignatureAppearance.
> PreClose() Line 677 + 0x9 bytes
>   iTextSharpSign.exe!iTextSharp.text.pdf.PdfStamper.Close()
> Line 189 + 0xa bytes
>   iTextSharpSign.exe!iTextSharpSign.PDFSigner.Sign(string
> SigReason = "", string SigContact = "", string SigLocation =
> "", bool visible = true) Line 294 + 0xa bytes
>  
> iTextSharpSign.exe!iTextSharpSign.Form1.button1_Click(object
> sender = {Text = "Sign"}, System.EventArgs e = {X = 33 Y = 14
> Button = Left}) Line 109 + 0x61 bytes
>   [External Code]
>   iTextSharpSign.exe!iTextSharpSign.Program.Main() Line 17 +
> 0x1a bytes
>   [External Code]
>
> Thank you
> David
>
> Paulo Soares <psoares@(protected)> wrote:
>
>   What you're tying is possible because PdfReader(string
> file, byte[]
>   ownerPassword) will remove the encryption and will
> allow the PDF to be
>   signed. I've no idea where the error comes from as you
> don't show any stack
>   strace.
>  
>   Paulo
>  
>   -- -- Original Message -- --
>   From: "David Saier"
>   To:
>   Sent: Tuesday, July 11, 2006 9:05 PM
>   Subject: [iText-questions] Adding a signature to an
> encrypted pdf document.
>  
>  
>   Hello,
>  
>   I have been trying to use iText to create a signature
> in an encrypted pdf
>   document. Basically I have a pdf document which is
> password encrypted with a
>   known owner password, and I want to add a signature to
> it. When I try it it
>   gives me an "Object reference set to null" error,
> making me believe the
>   problem is in accessing the document. I have gotten my
> code to work if the
>   pdf is not encrypted, however this is not an option for
> me, I have to have
>   the document locked before I add a signature to it.
>  
>   Using the PdfReader(string file, byte[] ownerPassword)
> constructor for the
>   PdfReader I pass into the PdfStamper.CreateSignature
> does not seem to work.
>  
>   Is what I am trying to do possible?
>  
>   Thanks,
>   David
>  
>  
>   -- ---- ---- ---- ---- ---- -----
>   Yahoo! Music Unlimited - Access over 1 million
> songs.Try it free.
>  
>  
>  
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
> -- ---- ---- -----
>  
>  
>   >
>   >
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
> -- ---- ---
>   > 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
>   > iText-questions@(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
>   iText-questions@(protected)
>   https://lists.sourceforge.net/lists/listinfo/itext-questions
>  
>
>
> __ ____ ____ ____ ____ ____ ____
>
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail Beta.
> <http://us.rd.yahoo.com/evt=42297/*http://advision.webevents.y
> ahoo.com/handraisers>
>


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
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions

©2008 junlu.com - Jax Systems, LLC, U.S.A.