Jump to content

Digitally sign PDF document


Recommended Posts

I try to add this code:

$certificate="file:///data/web/virtuals/dev.smarthost.cz/secure/smarthost.crt";
$info = array(
       'Name' => 'TCPDF',
       'Location' => 'Office',
       'Reason' => 'Testing TCPDF',
       'ContactInfo' => 'http://www.tcpdf.org',
);

$pdf->setSignature($certificate,$certificate,'','',2,$info);

to invoicepdf.tpl in my template direcory, but document is still unsigned.

 

What I do wrong?

Link to comment
Share on other sites

  • 1 year later...

Sorry for resurrecting an old thread, but since the TCPDF library has been updated with v4.5, I assume that digitally signing invoices should now be possible (somehow). Unfortunately, the code above still doesn't work.

 

Any suggestions would be greatly appreciated. Most EU-based companies are legally required to digitally sign invoices, so this function is quite important.

Link to comment
Share on other sites

Matt, One of my client's also reported the same issue. Following is his ticket that he raised with me.

 

~~~~~~~~~~~~

when i login to my client area to charge my account with Paypal ( in "Add Fund" section ) ,i see the folowing error message :

" TCPDF ERROR: Could not include font definition file: custom "

so i cant charge my account when i recieve this error.

~~~~~~~~~~

Edited by xuser
Link to comment
Share on other sites

and some cron jobs are also giving this error message:

 

~~~~~~~~~~~~~~~~~

Cron <username@congo> php -q /home/username/public_html/billing/admin/cron.php

<strong>TCPDF ERROR: </strong>Could not include font definition file: custom

~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
  • 2 months later...

Seems to work fine in my tests. Heres the code I added to invoicepdf.tpl

 

// Sign PDF
$certificate = 'file://'.ROOTDIR.'/test.crt';
$info = array(
       'Name' => 'Test',
       'Location' => 'Test',
       'Reason' => 'Signing Invoice',
       'ContactInfo' => 'Test');
$pdf->setSignature($certificate, $certificate, $info); 

 

The certificate contains both the private key and certificate, thats why its defined twice in the setSignature() function. More info on what needs to be passed to setSignature() can be found here:

 

http://www.tcpdf.org/doc/classTCPDF.html#a16ca73a301730e6e4dd368628bceeb75

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated