Jump to content

RockPdf - pdf filename format and option to sign documents


Recommended Posts

Hi.
I am sorry I did not have time sooner.
Regarding my questions in pub I created topic for them here.

So first was about pdf filename format.
I have in ready.php this:

// add hook after page has been saved -  pdf pro ks
$wire->addHookAfter("Pages::saved(template=ks-import-hlavicka)", function ($event) {
    $page = $event->arguments(0);
  
    /** @var RockPdf $pdf */
    $pdf = $event->wire->modules->get('RockPdf');
    $pdf
        ->load("/site/templates/ks-tisk.php", [
        // make saved page available as $page
        // in the loaded document file
        'page' => $page,
      ]) 
        ->saveToField(
        page: $page,
        field: 'pdf',
        filename: $page->name,
        append: false,
      );
  });

$page->name is for example nz-0556-24 and when I look for file in page editor it shows this:
image.png.ad010828fedbd0bc6aee4b2f197519ce.png

It is filename with "." at the end.
When I click on it and save it I have file named "nz-0556-24_.pdf"
Is possible to eliminate that "." and "_" ????

Next question was just how to integrate some secure form of electronic sign of PDF documents.
I could include image with sign but there could be nice to have some option to include digital signatures and certificates same way as is possible to normal PDF documents.
I searched for mPDF about it but there is no option there.
There is info that mPDF is not supporting it on github : https://github.com/mpdf/mpdf/issues/184

So for me it would be nice to have it in RockPdf but it is not crucible now.

Just let me know what could be done with that filename...

Link to comment
Share on other sites

On 7/4/2024 at 7:30 PM, PavelRadvan said:
filename: $page->name,

Hey @PavelRadvan this would be the correct syntax:

filename: "{$page->name}.pdf",

You just have to add the .pdf - that's the indented use. But I've pushed a "fix" that let's you use $page->name as well in v1.7.1

Link to comment
Share on other sites

Hi. Thanks and I tried new version v1.7.1 and now it works nice.
It appears that you have two versions - 1.7.1 newest commercial (i could download from baumrock) and directly from PW is possible to update to 2.1.0
Which one is right ?

Link to comment
Share on other sites

Great!

v2.1.0 is the old one that is not maintained any more (last update was in Jan 2023):

Quote

This module is deprecated in favour of my new commercial module: https://www.baumrock.com/en/processwire/modules/rockpdf/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...