webhoes Posted September 11, 2020 Share Posted September 11, 2020 2 hours ago, kongondo said: @webhoes it is recommended to use the spoiler tags to wrap very long text. I've done this for your post above. Thanks. Sorry @kongondo, I was not aware that. Thanks. Link to comment Share on other sites More sharing options...
kongondo Posted September 11, 2020 Share Posted September 11, 2020 59 minutes ago, webhoes said: Sorry @kongondo, I was not aware that. No worries...but no need to apologise though 😉. It's just a 'community' recommendation not a rule. Link to comment Share on other sites More sharing options...
a-ok Posted December 2, 2020 Share Posted December 2, 2020 Is it possible to assign a PDF filename via a hook? I want to assign a different filename (custom, not using {page.id} etc) for different pages. Link to comment Share on other sites More sharing options...
webhoes Posted December 2, 2020 Share Posted December 2, 2020 6 minutes ago, a-ok said: Is it possible to assign a PDF filename via a hook? I want to assign a different filename (custom, not using {page.id} etc) for different pages. Probably. You can also do this and use variables. $print_date = date("jMY", time()); $pdf->save(); $pdf->download('Logbook - ' . $drone->title . ' - ' . $print_date . '.pdf'); Link to comment Share on other sites More sharing options...
pwFoo Posted December 9, 2020 Share Posted December 9, 2020 Hi, I would build a website with embedded videos (because of used video source maybe need to use iframe...) and would like to export sites to PDFs. Before I start with PW / pages2pdf... is it possible to export a page to pdf with the embedded video? Anyone tested that use case? Regards Link to comment Share on other sites More sharing options...
tires Posted July 20, 2021 Share Posted July 20, 2021 Is there a way to get this running with php 7.3? How can i upgrade the mpdf version? The files that i can download here https://github.com/mpdf/mpdf/releases doesn't look very much like the ones i got in my /site/modules/Pages2Pdf/mpdf folder. Or is this module not usable anymore? Thanks! 1 Link to comment Share on other sites More sharing options...
Flashmaster82 Posted October 15, 2021 Share Posted October 15, 2021 Hi, i need some help from you prefessionals. I need to generate multiple pdf´s on the same page but with different content and styling. So you could have the folder for example /pages2pdf _footer.php, _header.php, _default.php, styles.css _footer2.php, _header2.php, _default2.php, styles2.css etc.. This is my generated button from the module i have now. So i need multiple buttons on the same page that generates different content and styling. <?php $options = array( 'title' => 'Print PDF', 'markup' => '<a href="{url}" target="_blank" title="OFFERT" rel="noopener"><div class="button secondary-button">OFFERT</div></a>', 'page_id' => '', // Pass a page ID if you want to download the PDF for another page ); echo $modules->get('Pages2Pdf')->render($options);?> Is that possible? Please somebody help... Link to comment Share on other sites More sharing options...
Wanze Posted October 23, 2021 Author Share Posted October 23, 2021 Hi @Flashmaster82 Quote I need to generate multiple pdf´s on the same page but with different content and styling. In this case you need to use the module "WirePDF" bundled in the Pages2Pdf module. You can use WirePDF to generate PDFs with custom content and styling. The readme has some examples how to do this: https://github.com/wanze/Pages2Pdf#wirepdf I suggest to also take a look at other existing ProcessWire PDF modules, as this one is really old and not maintained actively - it still works though 😅 Cheers 3 Link to comment Share on other sites More sharing options...
Flashmaster82 Posted October 23, 2021 Share Posted October 23, 2021 For anyone with the same problem here is my code for generating custom and multiple pdf´s on the same page with different content and styling. <?php $pdf = $modules->get('WirePDF'); $pdf->markupMain = $config->paths->templates . '/pages2pdf/custom.php'; $pdf->markupFooter = $config->paths->templates . '/pages2pdf/custom_footer.php'; $pdf->cssFile = $this->config->paths->templates . '/pages2pdf/custom_style.css'; $pdf->pageOrientation = 'P'; $pdf->pageFormat = 'A4'; $pdf->bottomMargin = 10; $pdf->save('pages2pdf/custom.pdf'); echo "<a href='{$config->urls->templates}pages2pdf/custom.pdf' download>Download PDF</a>"; ?> 3 Link to comment Share on other sites More sharing options...
Flashmaster82 Posted October 24, 2021 Share Posted October 24, 2021 Also if you want to preview the PDF when working on the styling. I added ob_clean(); because otherwise it only works in Firefox. <?php $pdf = $modules->get('WirePDF'); ob_clean(); $pdf->markupMain = $config->paths->templates . 'pages2pdf/custom.php'; $pdf->markupFooter = $config->paths->templates . 'pages2pdf/custom_footer.php'; $pdf->cssFile = $this->config->paths->templates . 'pages2pdf/custom_style.css'; $pdf->pageOrientation = 'P'; $pdf->pageFormat = 'A4'; $pdf->bottomMargin = 10; $pdf->download('pages2pdf/custom.pdf'); echo "<a href='{$config->urls->templates}pages2pdf/custom.pdf' download>Download PDF</a>"; ?> 2 Link to comment Share on other sites More sharing options...
Luigi Posted April 21 Share Posted April 21 Hello everyone. I started a while ago with processwire and I like it a lot 🙂 But now I ran into some problems with pages2pdf and I hope someone has a solution for those problems: 1. I try to add pictures (mostly pngs) into a pdf but some aren't shown and I can't tell why. The picture are shown on the webpage but not in the created PDF: I create them with this command: $picture->size(100)->httpUrl It works for some pictures but not for all. I think it has something to to with the way processwire creates the smaller picture because it works fine with this command: $picture->httpUrl when I remove the size command. 2. to make it even more complicated, some pictures aren't even visible with this command. Maybe it's a problem with the transparency from png. but other formats and some pictures without transparancy are also affected. I would be happy if someone has a tip or could tell me what I'm doing wrong or if there is a setting to change, thanks. Link to comment Share on other sites More sharing options...
bernhard Posted April 21 Share Posted April 21 Hi @Luigi does ->filename work? Link to comment Share on other sites More sharing options...
Luigi Posted April 22 Share Posted April 22 Hello @bernhardthanks for your suggestion but filename works only for the picture where httpUrl is also working. I don't think it's a problem with the links but with the way the original picture are created. mostly pictures with a white or black background instead of as transparent one are working fine. 🤔 Link to comment Share on other sites More sharing options...
Flashmaster82 Posted April 26 Share Posted April 26 You can only have Jpg images so try and change and see if it works. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now