Jump to content

Recommended Posts

@ICF Church Hi, I've released new version which should fix your problem, I know it is a little bit late but if you are still interested, you may try it.

I didn't face the error before but now, there are some misterious ways to me how PW detect module updates and sometimes detect the updated module as a new module so the `upgrade` method is not executed and the namespaces are not fixed which leads to the error mentioned by you. So I've moved the 'namespaces fix' code to the init method so it will check if the namespaces are fixed each time the module is initialized.

It may happed that you will see the 'Fieldtype 'FieldtypePDF' does not exist' when updating the module, just hit the refresh button again and you are fine.

  • Like 1

Share this post


Link to post
Share on other sites

Hi, i use PW 3.0.123 and can't use your module

 Class 'Pagefile' not found (Zeile 39 in /kunden/310636_12107/webseiten/meab/dev/site/modules/FieldtypePDF/FieldtypePDF/PagePDF.php) 

PDF with thumbnail

FieldtypePDF

1.1.5

i install from github cause the php-files (in subfolder FieldtypePDF) were empty after regularly module installation from pw repository 

 

Edited by ThomasH

Share this post


Link to post
Share on other sites

Hi @Richard Jedlička

thanks a lot for this useful modul!!
Unfortunately i am running into following issue.
When trying to upload a PDF i get this error and the upload fails.
 

Failed to read the file (in /wire/modules/Inputfield/InputfieldFile/InputfieldFile.module line 790)


I´m using PW 3.0.95 - and the FieldtypePDF 1.1.5.
PHP Version: 7.2.4
ImageMagick: I
mageMagick 6.9.4-6 Q16 i686 2016-06-03

Do you know anything about this?

Thanks!

 

Share this post


Link to post
Share on other sites

Hi guys,
I'm sorry to hear you have the issues. Unfortunatelly I don't have enough time to look at it now, I hope I'll find some in a few weeks. If you can examine it by yourself, you are welcome to send a PR. 

Cheers, Richard

Share this post


Link to post
Share on other sites
5 hours ago, itsberni said:

Failed to read the file (in /wire/modules/Inputfield/InputfieldFile/InputfieldFile.module line 790)

How did you install the module? If you copied the files manually I am guessing this is simply a file permissions issue - make sure everything has the correct owner and permissions that allow reading of the files. 

Share this post


Link to post
Share on other sites

Hy adrian,

i installed the module over the pw-backend as Admin.

it‘s all curios, because in my dev-enviroment with pw 3.0.123 and php7.0 it works.

The difference between both cases is the Server-enviroment....

Share this post


Link to post
Share on other sites

Sorry @itsberni - I totally misread the error message - obviously not a file permission issue for those modules - sorry for the wild goose chase.

 

Share this post


Link to post
Share on other sites

Hi all,

tried several things.....changed the php-version on the Server (down to 7.0). Updating pw to the latest master (123). Uninstalling and installing the module again.

the result is the same.

could there be any problem with the server (mittwald) to handle pdf-files in terms of security?

any thoughts or suggestions?

 

SOLUTION:

The PHP-Version has to be 7.0.32 CGI - now it works!!

Share this post


Link to post
Share on other sites

@itsberni

I just ran into this on my development server (using PHP7.2)

The clues to a fix were found here.  NB, this module doesn't need ImageMagick/Ghostscript to have write permissions for PDFs to generate the thumbnails, read permission worked just fine for me.

  <policy domain="coder" rights="read" pattern="PDF" />

 

  • Like 2

Share this post


Link to post
Share on other sites
On 1/4/2019 at 2:37 PM, ThomasH said:

Hi, i use PW 3.0.123 and can't use your module

 Class 'Pagefile' not found (Zeile 39 in /kunden/310636_12107/webseiten/meab/dev/site/modules/FieldtypePDF/FieldtypePDF/PagePDF.php) 

   

Hi @ThomasH

In file PagePDF.php on lines 32,33,34 change to:

use ProcessWire\Pagefile;
use ProcessWire\Pageimage;
use ProcessWire\Pageimages;

and in file PagePDFs.php add ProcessWire\ namespace for Pagefiles as well (on line 29)

BTW @Richard Jedlička very useful module for me now 🙂 Thanks a lot!

Working on PW 3.0.133, PHP 7.3.8 FPM (FieldtypePDF v. 1.1.5)

Share this post


Link to post
Share on other sites

First of all many thanks to @Richard Jedlička for this great module. It does exactly what I was looking for, unfortunately I have a problem with the generated thumbnails: German umlauts are simply not displayed. In the ImageMagick documentation I can't find any hint and can only assume that it is somehow related to Ghostscript?

Maybe someone of you already had the same problem found and a solution?

Many thanks in advance!

Cheers,
Florian

Share this post


Link to post
Share on other sites
35 minutes ago, snck said:

generated thumbnails: German umlauts are simply not displayed

No umlauts in the cover/screenshot of your uploaded PDF?
Do you use some special fonts in the PDF which are not embedded?

I got the module working somehow and threw a ton of PDFs at it and there were lots of ä,ö,ü and ß.

Share this post


Link to post
Share on other sites
18 minutes ago, wbmnfktr said:

No umlauts in the cover/screenshot of your uploaded PDF?
Do you use some special fonts in the PDF which are not embedded?

Yes, I get no umlauts in the generated image. The only font used is AvenirLT-Medium, which is embedded correctly (at least Adobe Acrobat tells me it is). The PDF hat been generated with Adobe Indesign. Left of the attached image is the output I get from the module, on the right site the PDF in Acrobat as reference.

Bildschirmfoto 2019-09-30 um 15.53.30.png

Share this post


Link to post
Share on other sites

Just queried Google and there might be a problem with either

  • ImageMagick
  • Ghostscript
  • Missing fonts
  • Wrong/false/incomplete embedded fonts
  • Other font issues

Or in short... if it's a server-related you might have to dig quite deep into it. From ImageMagick versions to installed Ghostscript fonts to (above mentioned) policy restrictions. Depending on your hosting or the client's hosting it might not even work. Shared hosting plans don't allow access to files and folders - but in most cases those environments are pretty well configured.

It might be easier to create a already pre-rendered first page for the PDF without any real text and fonts. Maybe converting them to paths or however it works in InDesign.

As it is only a download and nothing you'd push to a print shop, it should work out just fine.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for your quick reply! My problem is that the client generates the PDF himself, it contains a lot of pages and gets updated regularly. Our goal is to streamline his workflow by offering him to upload just one file and having the website generate thumbnails for all pages with hi-res previews as well. I will play around with Indesign's PDF export options and try wo solve the problem by converting the fonts to paths, but we do not want to loose the ability to search in the PDF. I will try to test it on the client's server as soon as possible, maybe the configuration there magically solves my problem 😉

Share this post


Link to post
Share on other sites

After upgrading to the latest master 3.0.148 coming from the 3.0.123 version, this module stopped working in the sense that i am no longer able to upload files.

I get the following error message:

NOT AUTHORISED /files/assets/8888/filename.pdf @ error/constitute.c/ReadImage/412

Share this post


Link to post
Share on other sites

I am still having issues with this module. this is what the error log shows running 3.0.148:

Fatal Error: Uncaught TypeError: Argument 1 passed to InputfieldPDF::getAdminThumb() must be an instance of FieldtypePDF\PagePDF, instance of Pagefile given, called in /site/assets/cache/FileCompiler/site/modules/FieldtypePDF/InputfieldPDF.module on line 111 and defined in /site/assets/cache/FileCompiler/site/modules/FieldtypePDF/InputfieldPDF.module:57 Stack trace:
1. /site/assets/cache/FileCompiler/site/modules/FieldtypePDF/InputfieldPDF.module(111): InputfieldPDF->getAdminThumb(Object(Pagefile))
2. /wire/core/Wire.php(389): InputfieldPDF->___renderItem(Object(Pagefile), 'pdf_manual_6feb...', 0)
3. /wire/core/WireHooks.php(823): Wire->_callMethod('___renderItem', Array)
4. /wire/core/Wire.php(450): WireHooks->runHooks(Object(InputfieldPDF), 'renderItem', Array)
5. /wire/modules/Inputfield/InputfieldFile/InputfieldFile.module(562): Wire->__
Line 57 of /site/assets/cache/FileCompiler/site/modules/FieldtypePDF/InputfieldPDF.module

 

Anyone experience or suggestions how to get around this?

Share this post


Link to post
Share on other sites

hello @Richard Jedlička, i found the issue. It was not an issue with the module but a problem with an ImageMagick-6 policy update on my Ubuntu machine, which seems to have happen around the same time as i updated my Processwire version:

The solution to my problem was to edit

/etc/ImageMagick-6/policy.xml

than change the following line from:

<policy domain="coder" rights="none" pattern="PDF" />

to

<policy domain="coder" rights="read|write" pattern="PDF" />
and added the following line
<policy domain="coder" rights="read|write" pattern="LABEL" />

By changing the policy you have to make sure that you can trust the users that upload the pdf files. 

  • Thanks 1

Share this post


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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By MoritzLost
      This module allows you to integrate hCaptcha bot / spam protection into ProcessWire forms. hCaptcha is a great alternative to Google ReCaptcha, especially if you are in the EU and need to comply with privacy regulations.

      The development of this module is sponsored by schwarzdesign.
      The module is built as an Inputfield, allowing you to integrate it into any ProcessWire form you want. It's primarily intended for frontend forms and can be added to Form Builder forms for automatic spam protection. There's a step-by-step guide for adding the hCaptcha widget to Form Builder forms in the README, as well as instructions for API usage.
      Features
      Inputfield that displays an hCaptcha widget in ProcessWire forms. The inputfield verifies the hCaptcha response upon submission, and adds a field error if it is invalid. All hCaptcha configuration options for the widget (theme, display size etc) can be changed through the inputfield configuration, as well as programmatically. hCaptcha script options can be changed through a hook. Error messages can be translated through ProcessWire's site translations. hCaptcha secret keys and site-keys can be set for each individual inputfield or globally in your config.php. Error codes and failures are logged to help you find configuration errors. Please check the README for setup instructions.
      Links
      Github Repository and documentation InputfieldHCaptcha in the module directory (pending approval) Screenshots (configuration)

      Screenshots (hCaptcha widget)

       
       

       
    • By joshua
      This module is (yet another) way for implementing a cookie management solution.
      Of course there are several other possibilities:
      - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/
      - https://github.com/webmanufaktur/CookieManagementBanner
      - https://github.com/johannesdachsel/cookiemonster
      - https://www.oiljs.org/
      - ... and so on ...
      In this module you can configure which kind of cookie categories you want to manage:

      You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience.
      Currently there are four possible cookie groups:
      - Necessary (always enabled)
      - Statistics
      - Marketing
      - External Media
      All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ...
      When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax:
      <script type="text/plain" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The type has to be "optin" to get recognized by PrivacyWire, the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision.
      If you want to give the users the possibility to change their consent, you can use the following Textformatter:
      [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie.
      You can also add a custom link to output the banner again with a link / button with following class:
      <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> This module is still in development, but we already use it on several production websites.
      You find it here: PrivacyWire Git Repo
      Download as .zip
      I would love to hear your feedback 🙂
      CHANGELOG
      0.1.1 Debugging: fixed error during uninstall 0.1.0 Added new detection of async scripts for W3C Validation 0.0.6 CSS-Debugging for hiding unused buttons, added ProCache support for the JavaScript tag 0.0.5 Multi-language support included completely (also in TextFormatter). Added possibility to async load other assets (e.g. <img type="optin" data-category="marketing" data-src="https://via.placeholder.com/300x300">) 0.0.4 Added possibility to add an imprint link to the banner 0.0.3 Multi-language support for module config (still in development) 0.0.2 First release 0.0.1 Early development
    • By bernhard
      --- Please use RockFinder3 ---
    • By cosmicsafari
      Hi all,
      I have need to dynamically set InputFieldMultiSelect to  selected on page load based on the status of some items within a database table.
      However I keep running into issues when trying to do this via InputfieldSelect::setOptionAttributes()
      https://processwire.com/api/ref/inputfield-select/set-option-attributes/
      Going by the above it sounds like it should be pretty straight forward, and for certain values it seems to work but not when I wanted to set it to 'selected'.
      For example:
      $f->setOptionAttributes(1030,['foo' => 'test']); The above works as I would have wanted, in that it updates the option with the value 1030, to include the attribute foo="test"
      But the same code above edited to the following:
      $f->setOptionAttributes(1030,['selected' => 'selected']); Doesn't seem to do anything?
      I assume I'm missing something or trying to implement the 'selected' wrongly but I'm not sure how else I should approach this, any advice would be much appreciated.
       
×
×
  • Create New...