• Hi,

    I’ve already developed a custom PDF template, but I would like to be able to have the option to choose from different PDF templates from the download button for a single post.

    Any direction on this would be greatly appreciated.

    Cheers

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author dinamiko

    (@dinamiko)

    Hi @alandloh, do you mean different templates for different post types? or different templates for the sampe post type?

    By default the template expects a pdf parameter in the url that it uses to query the post by id, one option could be to add more params like pdf=123&template=foo and then based on that value render one content or the other.

    I’m not in the computer now but I can provide you some code this week, just let me know.

    Thread Starter Alan Loh

    (@alandloh)

    Hi @dinamiko

    I mean different templates for the same post type.

    Ooo, that’s great to know, I couldn’t find any information about this in the documentation.

    And yes please, that would be great if you could provide some code for this.

    Cheers

    Thread Starter Alan Loh

    (@alandloh)

    Hi @dinamiko,

    I managed to figure it out on my own by editing dkpdf-functions.php and adding this line at 203

      if (isset($_GET['template']) && $_GET['template'] === 'sunfert') {
        $mpdf->WriteHTML( dkpdf_get_template( 'dkpdf-sunfert' ) );
      } else {
        $mpdf->WriteHTML( dkpdf_get_template( 'dkpdf-index' ) );
      }

    Is there any way to do this with a filter rather than modifying the plugin?

    Cheers

    Plugin Author dinamiko

    (@dinamiko)

    Hi @alandloh, glad that you figured it out, regarding filter there isn’t any there at the moment but I take note to add one for the next release, I’ll let you know here when released and documented.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.