Jump to content
Wanze

Pages2Pdf

Recommended Posts

1 hour ago, iNoize said:

EDIT: Have stiill problems. If I edit something in the default_templates the Module dont use the new changes
Something with cache or how can i  change this ?

Yes, in Pages2Pdf module settings :

Capture.PNG.5ef932891f09afbfe490b222b64d9075.PNG

 

You can stay with PHP 7.3.x, and you can also try the same method to update it with the last mPDF version. If it didn't work, then use an older mPDF version like I did. 

Share this post


Link to post
Share on other sites
43 minutes ago, flydev said:

Yes, in Pages2Pdf module settings :

Capture.PNG.5ef932891f09afbfe490b222b64d9075.PNG

 

You can stay with PHP 7.3.x, and you can also try the same method to update it with the last mPDF version. If it didn't work, then use an older mPDF version like I did. 

Don't really work for me with the 1 in the cache. I'll try to update mpdf and set php to 7.3 maybe then. 

EDIT: Ok the latest mpdf have other filestrukture i think i cant replace the folder so easy also i will stay at 6.1 but i cant see my custom template files. Where could the problem be ? 

Share this post


Link to post
Share on other sites

Hi @All, @Wanze thanks for the module!

Please mates, is there a way to add pdf button/link to backend template? I need to print particular template from backend.

 

Share this post


Link to post
Share on other sites

That's a really great module! Thanks a lot!

On localhost it works perfect. But on the server I have the problem, that it don't creat the pdf file correctly. The file has only 0 Bytes and there is an error if I open it. Somethink like "the file is damaged". Does somebody has an idea where to problem is? On Chrome DevTools is this error:

Resource interpreted as Document but transferred with MIME type application/pdf:

Thanks for your help.

 

<a href="<?php echo $page->url;?>?pages2pdf=1">PDF erstellen</a>

 

Share this post


Link to post
Share on other sites

SOLVED: On the server "readfile()" was disallowed

One problem was, that I used PHP 7.2 on the server. Now i changed to PHP 5.6.

But if I click on the Link (<a href="<?php echo $page->url;?>?pages2pdf=1">PDF erstellen</a>), the file is saved on the server in /site/assets/files/page-id. But no visiual download ond the webpage. It opens just a empty page with the following url: .../page_name?pages2pdf=1. On localhost it works. Does somebody has an idea where my fault is? Thank you.

Share this post


Link to post
Share on other sites

Hello I get this Error if I try to Execute ImportPagesFrom XML 

 

Fatal Error: Uncaught TypeError: Argument 2 passed to Pages2Pdf::getPDFFilePath() must be an instance of Language, instance of ProcessWire\Language given, called in /usr/www/users/ulmmsc/2018cms/site/modules/Pages2Pdf/Pages2Pdf.module on line 177 and defined in /usr/www/users/ulmmsc/2018cms/site/modules/Pages2Pdf/Pages2Pdf.module:259

Language Support is installed. 
 

Also is Multilanguage Checked in the pages2PDF Module 

Share this post


Link to post
Share on other sites

Guys I'm really desperate. The templates can not be changed, I have no idea why. Not the headers or not the default it always stays the same.

It also does not work with Multilanguage. Is nobody there who can help me?

Share this post


Link to post
Share on other sites

The better the questions the better the answers. 

1 hour ago, iNoize said:

The templates can not be changed, I have no idea why.

You cannot expect that forum members can remember the exact problem that you have posted several weeks ago. Describe your problem. Try to make it reproducable (eg by providing a site profile of a clean installation that shows the problem) and I'm sure there will be someone who can help you.

Sometimes even describing the problem as good as you can brings you to the solution 😉 

  • Like 1

Share this post


Link to post
Share on other sites

Just to get the records straight...

  • ProcessWire version?
  • Multilanguage profile or another profile made multilanguage?
  • How many languages?
  • Does it work in any of the languages?
  • PHP version?
  • Module version?
  • How do you generate the PDFs? Code snippet would be great
  • Where do you create the PDFs - frontend or backend?
  • Templates: page or PDF?
  • Template location?
  • Template strategy - delayed, direct, regions?
  • Like 3

Share this post


Link to post
Share on other sites

@bernhard @wbmnfktr

Thanks for the fast answer. So i try to describe the situation. 
I have installed the module.  CURRENTLY SITCHED OFF THE MULTINLANGUAGE SUPPORT ON PW 

ProcessWire 3.0.126 © 2019
PHP 7.2  
Screenshot_3.thumb.jpg.e85f681a55fad9dab9bdab76d0a1b872.jpg

 

So now if i try to change the templates in /site/modules/Pages2Pdf/default_templates
for example 

default.php 
<h1><?= $page->get('headline|title') ?></h1>
<p><?= $page->body ?></p>

<?php if (count($page->immo_images)): ?>
    <?php foreach ($page->immo_images as $image): ?>
        <div class="image">
        <img src="<?= $image->size(400, 400)->url ?>" alt="<?= $image->description ?>" />
        </div>
    <?php endforeach; ?>
<?php endif; ?>


_header.php 
<?php
/*
 * Pages2Pdf default header markup
 * Styles defined in styles.css file
 *
 * You can use {PAGENO} for the current page number and {nbpg} for the total of pages
 *
 */
?>

<div class="head">Test </div>
Hier kommt EXPOSE 
<hr>
Hallo WELT 

Then try to generate the file on the site 

 

$options = array(
  'title' => 'Expose als PDF',
  'markup' => '<a href="{url}" target="_blank" class="btn button-sm border-button-theme col-lg-12 col-md-12 col-xs-12 margin-b-10"  >{title}</a>',
  //'page_id' => '', // Pass a page ID if you want to download the PDF for another page
);
echo $modules->get('Pages2Pdf')->render($options);

nothing happens. 
It generates always the same PDF see as attached. 
There is the standart header and footer. 
Also on the content is the standart code. 

THE CACHE IS ON 1 

 

 

 

neubau-einfamilienhaus-in-burgrieden-pdf-1148 (1).pdf

Share this post


Link to post
Share on other sites

I tried this:

  • fresh 3.0.123 installation
  • multilanguage profile
  • PHP 7.2
  • latest Pages2PDF module

2019-10-02-165040_1683x1417_scrot.thumb.png.db7377434462b967970a511a2f63da7c.png

At first I saw no changes at all because I changed the wrong templates in /site/modules/Pages2PDF/default_templates/ and not those in /site/templates/pages2pdf/.

Right now... all I can say is: it's working as expected. Sure... there is no custom code in my page templates or anythings. Just the basic stuff.

My recommendation: try it with a simple basic template without anything else in it. Maybe even blindtext. Maybe the reason for your errors are at a different place than the module itself.

Update: just saw in your post that you ARE in the wrong folder with the wrong templates.

  • Like 3

Share this post


Link to post
Share on other sites

@wbmnfktr 
ok thats really embrrassing now. 

With the Templates I was in the wrong path. The module  path not the template. 

With the multilanguage i installed not the profile only the module (part of PW Multilanguage Support )
But thanks a lot for the HELP. Now it works with the PDF files without multilanguage. 


 

Share this post


Link to post
Share on other sites

You will remember it the next time. 😉 

I checked the multilanguage support... that worked as well.

2019-10-02-173828_1993x507_scrot.thumb.png.69d3bfb8d630fef9a97aec62eb1dfba1.png

As said before... try taking it apart with just a few simple templates to find the real problem.

  • Like 2

Share this post


Link to post
Share on other sites

@wbmnfktr OK I think the error is not in the pages2pdf I use to import files the ImportPages2Xml module and when the multilanguage is on then the error comes that pages2pdf

Fatal Error: Uncaught TypeError: Argument 2 passed to Pages2Pdf::getPDFFilePath() must be an instance of Language, instance of ProcessWire\Language given, called in /usr/www/users/ulmmsc/2018cms/site/modules/Pages2Pdf/Pages2Pdf.module on line 177 and defined in /usr/www/users/ulmmsc/2018cms/site/modules/Pages2Pdf/Pages2Pdf.module:259

Share this post


Link to post
Share on other sites
On 9/15/2017 at 10:14 AM, maxf5 said:

Hi bernhard,

thank you for the hint.  The image field is set as single element.
 


  <td colspan="1" style="padding:15px">
    <img src="<?= $page->navimg->url; ?>" width="220"/>
    <p><?= $page->navimg->url ?></p>
  </td>

something between ..

<?php if ($page->images->count > 0) : ?>
<table>
  <tr>
  <?php
    $gallery = $page->images;
    $gallery = $gallery->slice(0,4);
   foreach ($gallery as $image): ?>
    <td>
      <img src="<?= $image->size(200, 200)->url ?>" width="200" height="200"/>
    </td>
  <?php endforeach; ?>
  </tr>
</table>
<?php endif; ?>

 

template part:


<?php 
$optionspdf = array(
  'title' => 'Datenblatt',
  'markup' => '<a class="uk-button gaming" href="{url}" download>{title}</a>',
  'pageFormat' => 'A4'
);
echo $modules->get('Pages2Pdf')->render($optionspdf);
?>

 

result:

Unbenannt.thumb.PNG.434147903301c5d7a1ddea668fee6fee.PNG

 

Hello, have somebody solved it now ? 
The Problem i found out is with the png . 

Tried it with jpg it works. 
How to handle it with PNG Files ? 

Updated the mpdf to 6.1 

 

Share this post


Link to post
Share on other sites

I don't know what it was in my case but one of these things fixed it or at least I got the .png files in my PDFs:

  • using relative path to the file
  • installing GD and PHP GD extension (or was it ImageMagick?)

And somehow I was able to get more details about the problems aka got a real error message but it's way too long ago as I can remember this in full detail. 

 

Share this post


Link to post
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.

  • Similar Content

    • By eelkenet
      Hi! I've created a small Inputfield module called InputfieldFloatRange which allows you to use an HTML5 <input type="range" ../> slider as an InputField. I needed something like this for a project where the client needs to be able to tweak this value more based on 'a feeling' than just entering a boring old number. Maybe more people can use this so I'm hereby releasing it into the wild. 
      EDIT: You can now install it directly from the Modules directory: http://modules.processwire.com/modules/inputfield-float-range/
       
      What is it?
      The missing range slider Inputfield for Processwire. 
      What does it do?
      This module extends InputfieldFloat and allows you to use HTML5 range sliders for number fields in your templates.
      It includes a visible and editable value field, to override/tweak the value if required.  
      Features
      Min/max values Precision (number of decimals) Optional step value (Read more) Optional manual override of the selected value (will still adhere to the rules above) Configurable rounding of manually entered values (floor, round, ceil, disable) Usage
      Clone / zip repo Install FieldtypeFloatRange, this automatically installs the Inputfield Create new field of type `Float (range)` or convert an existing `Float`, `Integer` or `Text` field. To render the field's value simply echo `$page->field` Demo
      A field with Min=0, Max=1, Step=0.2, Precision=2

      Field with settings Min=0, Max=200, Step=0.25, Precision=2

       
      Todo
      Make the display-field's size configurable (will use the Input Size field setting)  Hopefully become redundant  
      Changelog
      004 (current version)
      - Make rounding of manually entered values configurable (floor, round, ceil or disable)
      - Fix small JS bug when the value-display field was not displayed
      - Update README
      003
      - Code cleanup, add some ModuleInfo data & LICENSE
      - Submit to PW Modules directory (http://modules.processwire.com/modules/inputfield-float-range/)
      002
      - Fix issue where setting the step value to an empty value created problem with validation
      - Make the display-field optional
      001
      - Initial release
       
      Thanks!
       
       
    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-10-18
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. Field widths entered into the Template Field Widths inputfield are only applied if the Edit Template form is submitted with the Template Field Widths inputfield in an opened state. "Collapsed" is the recommended setting if you think you might also use core inputs for setting field widths in a template context. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By adrian
      Tracy Debugger for ProcessWire
      The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS

       
      Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development
      The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger
      Modules Directory: http://modules.processwire.com/modules/tracy-debugger/
      Github: https://github.com/adrianbj/TracyDebugger
      A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.
×
×
  • Create New...