Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Problem with signing a PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Problem with signing a PDF

 Post Reply Post Reply
Author
Message
R-S View Drop Down
Beginner
Beginner
Avatar

Joined: 03 Jan 19
Location: Netherlands
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote R-S Quote  Post ReplyReply Direct Link To This Post Topic: Problem with signing a PDF
    Posted: 03 Jan 19 at 9:42AM
hey all,
I'm currently busy with figuring out how to sign a pdf.
I first convert a document type to pdf and then will try to sign the file with a pfx file.

public override string[] Convert(string[] bitmaps)
        {
            string filename = CoState.CreateWorkingFilename();

            using (mGenerator = new PDFProcessor())
            {
                PrepareGenerator();

                mGenerator.NewPages(bitmaps.Length - 1);

                mPageId = 1;
                
                ProcessPages(bitmaps);

                mGenerator.SaveToFile(filename);
                SignPFD(filename);

            }

            return new string[] { filename };
        }
public void SignPFD(string filename)
        {
            int temp;
            temp = mGenerator.SignFile(filename, "", "Tempfield", "C", "Certificate.pfx", "PASSWORD", "j", "i", "z");
            System.Console.Write(temp + "signfile output \n");
        }
but i get a Error:
    Exception thrown: 'System.AccessViolationException'
    An unhandled exception of type 'System.AccessViolationException'
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
when the programs tries to run the code SignFile.
Am i overlooking something?

PS. all the other things do work. The problems is only with signing the file

EDIT:
i have also tried another approach:
            mGenerator.DrawText(100, 700, "This is the file to be signed");
            mGenerator.SaveToFile("TheUnsignedFile.pdf");

            int SignProcessID = mGenerator.NewSignProcessFromFile("TheUnsignedFile.pdf", "");
            if (SignProcessID > 0) {
                mGenerator.SetSignProcessPFXFromFile(SignProcessID, "Certificate.pfx", "PASSWORD");
                mGenerator.SetSignProcessInfo(SignProcessID, "To test digital signatures", "The World", "Contact me");
                mGenerator.SetSignProcessField(SignProcessID, "Contract Signature");
                mGenerator.SetSignProcessFieldBounds(SignProcessID, 100, 600, 200, 100);
                mGenerator.SetSignProcessFieldImageFromFile(SignProcessID, "visualsignature.jpg", 0);
                mGenerator.EndSignProcessToFile(SignProcessID, "TheSignedFile.pdf");
            }
but i get the same Error at the function EndSignProcessToFile.


Edited by R-S - 03 Jan 19 at 12:51PM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2973
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 19 at 8:13PM
Hi Rens,

the described error is a very common one - reasons could be many for it...
Some things you should think over:
Which is your development-ID/...language?
How strings are handled inside?
String-handling in QuickPDF is always in unicode-format.
QuickPDF comes along as dll- and activex-version - which one you're using?
32- or 64-bit... system32- or syswow64-path...?
and so on... a lot to do for you first... Sorry ;-)
The online-reference, developer-guide and samples you've already found?

Cheers and welcome here,
Ingo



Edited by Ingo - 03 Jan 19 at 8:13PM
Cheers,
Ingo

Back to Top
R-S View Drop Down
Beginner
Beginner
Avatar

Joined: 03 Jan 19
Location: Netherlands
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote R-S Quote  Post ReplyReply Direct Link To This Post Posted: 04 Jan 19 at 8:37AM
Hey Ingo,

Thank for you reply.

I'm programming in C3 with visualstudio 2017.
As for the string handling. I looked it up and don't find a problem with the unicode-format.
The build target is set to any-cpu and VS is a 32-bit installation.
Also, i'm using the Dll version 9.16 got both 32 and 64 dll's

And yes, i have found the examples ans such. Thanks ^^

I hope this will give a little bit extra information.
I keep searching for the solution myself further.

Greeting,


Edited by R-S - 04 Jan 19 at 8:51AM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2973
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 04 Jan 19 at 10:47AM
Hi Rens,

the additions won't help.
It's like you're telling me that your car doesn't drive and that the reason is that the motor doesn't start. Sorry ;-)
Perhaps it has to do with the mixed installation... perhaps...
Try to separate 64/32 bit...
I don't think that you'll get another hint here...

Cheers,
Ingo

Back to Top
R-S View Drop Down
Beginner
Beginner
Avatar

Joined: 03 Jan 19
Location: Netherlands
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote R-S Quote  Post ReplyReply Direct Link To This Post Posted: 14 Jan 19 at 2:19PM
Hi Ingo,

I have been continue searching for the problem. It seems to be a problem with bit type you are using. If i call the function in a 32bit solution, the function works fine. But if i build a 64 bit solution i get the memory problem.

I also have tested it with a new project. Making a simple pdf en then trying to sign it. There the same problem occurs. 32bit works, 64 bit doesn't work.

Can it be that there is something wrong with variables that are parsed wrong in the libary if you use a 64 bit?

Also, the same problem also come with the function RenderPageToDC, but there the 64bit version works and the 32 bit version doesn't work.

I hope this might help people and maybe it is a bug?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2973
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 14 Jan 19 at 8:58PM
Hi Rens,

you shouldn't write these things to me.
I'm only a user...
I you think that there's an error in the library you should post it on the official support page of the publishers:
https://www.debenu.com/products/development/debenu-pdf-library/



Edited by Ingo - 14 Jan 19 at 8:58PM
Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store