GithubHelp home page GithubHelp logo

jako / pdfresource Goto Github PK

View Code? Open in Web Editor NEW
12.0 7.0 11.0 51.67 MB

Convert resources to PDF in MODX Revolution

Home Page: https://jako.github.io/PDFResource/

License: GNU General Public License v2.0

PHP 96.77% CSS 0.24% HTML 0.27% JavaScript 2.72%
modx-revolution modx modx-extra

pdfresource's Introduction

Default Lexicon

PDFResource

Convert MODX resources to PDF files.

Features

Convert MODX resources to PDF files on saving or on viewing the resource using mPDF (https://mpdf.github.io/).

Installation

MODX Package Management

Usage

Install via package manager, modify the system settings, template variables and chunks to create PDF files on resource base.

Documentation

For more information please read the documentation.

License

The project is licensed under the GPLv2 license.

Translations

Translations of the package can be made for the Default Lexicon and the System Setting Lexicon

pdfresource's People

Contributors

dependabot[bot] avatar jako avatar l1a7t avatar weblate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdfresource's Issues

Extra not saving resource as PDF

I've installed the most recent version in most recent version of modx hosted on modxcloud.

I've added the create pdf as tv to a template, and checked it so that it runs.

I then saved a resource and it doesn't save the resource, it just hangs with the saving popup just spinning.

Errors in inspector:

image

When I unchecked the Create Pdf checkbox it still did not work.

When I removed pdfresource from the template the resource saved without issue.

error message 502

on some websites an error message 502 is given when using pdfresources. The hoster says that there isn't enough memory for performance of PHP a code. In what there can be a reason?

Couldn't use Contexts

It works with the "web" context fine, but I can't seem to get it to produce anything for other custom contexts.

Error opening pdf on the fly

Revo 2.5.1
I've installed pdfresource, set the live_pdf TV on a blank template with no other content other than [[*content]], created a simple resource using the blank template, ticked the live_pdf TV and changed the content type to PDF.
When I browse to the page chrome (v53) alerts with unable to load pdf. IE 11 alerts with File does not begin with %PDF - local-EWH-59-880.
I've updated reader to latest DC version.

I've no idea where I'm going wrong - can you help please :-(

Package installation does not work

Hello Thomas. I tried to install the package on the Revo 2.5.7, use the hosting ModxCloud, but the installation hangs, with an error in the browser console:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

I tried to switch versions of php between 7.1 and 5.6, and on a clean installation 2.5.7 on the hosting https://en.modhost.pro/, the error still appears. The previous version of 1.5.5 is installed normally.

Generate live PDF from snippet instead of html resource

Dear,

I've used the TV's to generate on the fly, but it generates on the fly in the browser...What I want to do is generating the PDF via a snippet on the fly...Is it possible or I just need to do it using mpdf?

Regards,
Kevin

Fatal error: Allowed memory size

Hello Jako,
thanks for your fast help! For my current project i get the following error:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in core/xpdo/om/xpdoobject.class.php on line 1737

The template is empty and there are now tables in it.

Thanks a lot!
Jens

Failed to install on modx 2.7.1

Hi Jako, I tried installing PDFResource on my website (PHP 7.2.4), but while installing the package the installer hangs (only with this package). PDFResource creates all of its chunks, snippets, and plugin but doesn't show up in the manager as installed.

I've cleared the core/cache folder before installing, that doesn't work too. The installer shows this:

Konsole läuft...
Versuche, das Package mit der Signatur pdfresource-1.5.9-pl zu installieren
Package gefunden... Bereite jetzt die Installation vor.
Greife auf Package-Workspace zu...
Workspace-Umgebung eingerichtet, installiere jetzt das Package...
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.mode )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.format )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.defaultFontSize )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.defaultFont )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.mgl )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.mgr )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.mgt )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.mgb )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.mgh )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.mgf )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.orientation )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.customFonts )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.generateOnPrerender )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.permissions )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.userPassword )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.ownerPassword )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.mPDFMethods )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.pdfTv )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.pdfTvLive )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.pdfTvOptions )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.pdfTpl )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.cssTpl )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.processTVs )
Skipping vehicle object of class modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => pdfresource.tvPrefix )
Skipping vehicle object of class modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 55 [event] => OnDocFormSave )
Skipping vehicle object of class modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 55 [event] => OnWebPagePrerender ) 

After closing the install window which is stuck this messages are popping up in the error log:

[2019-09-23 23:22:49] (ERROR @ /storage/web/modx/core/xpdo/xpdo.class.php : 644) Could not load class: PDFResource from pdfresource.
[2019-09-23 23:22:49] (ERROR @ /storage/web/modx/core/xpdo/xpdo.class.php : 1247) Problem getting service pdfresource, instance of class PDFResource, from path /storage/web/modx/core/components/pdfresource/model/pdfresource/

Do you have an idea whats wrong?

Memory loss

When saving a resource, an error occurs.

Allowed memory size of 268435456 bytes exhausted (tried to allocate 130968 bytes) in "../core/xpdo/om/xpdoobject.class.php on line 1737"

modx 2.6.0
php 5.6.24

p.s Disable all plugins except PDFResource, Error not lost.

Default font always 'dejavusanscondensed'

Thanks for your job. I have one issua -
I tried add to "Custom Fonts"

{
  "Arial": {
    "R": "Arial.ttf"
  }
}

I copied to /core/components/pdfresource/vendor/mpdf/mpdf/ttfonts Arial.ttf and set 'PDF default font' 'Arial', but always get in my PDF font 'dejavusanscondensed'.

Failed to install on Modx 2.5.7

I tried installing PDFResource on two separate Modx 2.5.7 installs (Modx Cloud, and a local dev with Ampps). And both have the same issue.

PDFResource creates all of its chunks, snippets, and plugin. But doesn't show up in de install manager as installed.

Changing template

I use [[*create_pdf]] and want to change the template, which is called by the snippet for showing the selected tv's in the pdf. How can I do that?

Using png image data

I'm like some advice please :-)

I'm creating a pdf on the fly in a new tab with just an image in it using png image data. The resource doesn't convert to a pdf and just shows an empty image tag with the page name as the source.

If I use an image instead of the data it displays fine.

If I turn off creating pdf on the fly it works fine.

I've looked at the docs for mPDF and it says it okay using image data as the img source.

Can you tell me what I need to do to get it working?

Thanks very much.

infinite recursion when saving the document with the established tv create_pdf.

infinite recursion when saving the document with the established tv create_pdf. The document isn't saved and pdf the file isn't created

The website certain sql-makes request:

sendto(3, "U\1\0\0\3SELECT modTemplateVar.name,
modTemplateVarTemplate.templateid FROM jonakor_site_tmplvar_templates AS
modTemplateVarTemplate LEFT JOIN jonakor_site_tmplvars modTemplateVar ON
modTemplateVarTemplate.tmplvarid = modTemplateVar.id WHERE (
modTemplateVar.name = 'create_pdf' AND
modTemplateVarTemplate.templateid = 6 ) ", 345, MSG_DONTWAIT, NULL, 0) =
345 <0.000027>
21:39:05 poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 1471228928) = 1
([{fd=3, revents=POLLIN}]) <0.000026>
21:39:05 recvfrom(3,
"\1\0\0\1\2H\0\0\2\3def\7u459505\16modTemplateVar\25jonakor_site_tmplvars\4name\4name\f!\0\226\0\0\0
\375\5@\0\0\0e\0\0\3\3def\7u459505\26modTemplateVarTemplate\36jonakor_site_tmplvar_templates\ntemplat
eid\ntemplateid\f?\0\v\0\0\0\3\3@\0\0\0\5\0\0\4\376\0\0\2\0\r\0\0\5\ncreate_pdf\0016\5\0\0\6\376\0\0
2\0",
242, MSG_DONTWAIT, NULL, NULL) = 221 <0.000011>

which is generated, it is probable in the 30th line of this file:
/ ......../core/cache/includes/elements/modplugin/17.include.cache.php then occurs a recursion.

Could not create the pdf alias path

Hi Thomas, in my installation no PDFs are created or stored and I cannot figure out why. On the fly creation works as it should. I installed manually pdfresource-1.5.5-pl (pdfresource-1.5.6-pl package does not install) in Version 2.5.7
My Error Log says:
[2017-08-07 08:26:58] (ERROR in PDFResource @ {server_path}/core/components/pdfresource/model/pdfresource/pdfresource.class.php : 176) Could not create the pdf alias path: {alias_path}
Any tips? Is that possibly a permission problem?

Fatal error with PHP 7.0.8

Running on PHP 7.0.8 creating a PDF ends with the following error:

PHP Fatal error: 'break' not in the 'loop' or 'switch' context in …/core/components/pdfresource/vendor/mpdf/mpdf/classes/svg.php on line 2710

This Batch does fix it:

2710 - if (!$last_gradid) break;
2710 + if (!$last_gradid) return;

Could not create the pdf alias

Error

[2016-06-17 07:04:17](ERROR in PDFResource @ /connectors/index.php) Could not create the pdf alias path: /var/www/ainmoservices/www/assets/pdf/directory/sale/
[2016-06-17 07:04:27](ERROR in PDFResource @ /connectors/index.php) Could not create the pdf alias path: /var/www/ainmoservices/www/assets/pdf/directory/sale/
[2016-06-17 07:04:34](ERROR in PDFResource @ /connectors/index.php) Could not create the pdf alias path: /var/www/ainmoservices/www/assets/pdf/directory/sale/
[2016-06-17 07:04:43](ERROR in PDFResource @ /connectors/index.php) Could not create the pdf alias path: /var/www/ainmoservices/www/assets/pdf/directory/sale/

Error in getParentPath

PDFResource.php contains the function getParentPath which incorrectly uses rtrim.

return preg_replace('#(\.[^./]*)$#', '', rtrim($this->modx->makeUrl($resource->get('parent')), $this->modx->getOption('container_suffix'))) . '/';

The intent seems to be to remove the suffix from the parent resource, however, rtrim isn't the best for that as it removes any letter found in the suffix from the string.

Example: rtrim('muscat-mint.html', '.html') results in 'muscat-min', with the final 't' removed.

substr might be a better choice.

MODX 2.8.4
PDFResource: 2.0.0

Using a snippet to populate the pdfOptions TV on the resource

Hi,
Not an issue just a question - is there a way to dynamically add the options to pdfOptions in the TV on the resource?

I'm currently using {"cssTpl":"Aim_PDF_CSS","defaultFont":"Arial"} which works fine with the on-the-fly generated pdf, I want to give the user the option of picking a font. To try it I created a simple snippet that outputs the above options then called the snippet in the pdfOptions box in the TV on the resource. Unfortunately it doesn't work on the generated pdf and I've no errors in the log to check.

I'd appreciate any help or advice you can give me.

Thanks in advance :-)

How to debug problems

Hi,

I have a resource with embedded images.

After moving to a new server, I see a small red "x" instead of the images.

grafik

This is how it should look like:

grafik

I checked gd library and imagick support and on this side everything seems to be fine.

There are a couple of error related parameters in mdpf. "showImageErrors" seems to be the right one for this problem.

https://mpdf.github.io/reference/mpdf-variables/showimageerrors.html

How do I add this parameter to pdfResource?

pdfresource.mode system setting seems to be the right spot, but I'm not sure about the syntax.

["showImageErrors":1]

Doesn't work

Tanks for your work!

pdf file for downloading is not formed

Hello! I have such problem - the file for downloading (I use a chunk Create PDF) in the pdf folder is not formed. when using the create PDF on the fly method, everything is OK.

PDF reading permissions

Hello,
when creating the PDF document trough saving a document in MODX, the PDF is correctly created and stored. The PDF document permission however is set to 640 and the folder permission to 340. This creates 403 errors when opening.

I'm not sure where to start fighting the problem, so thanks for your advice!

led-hallenbeleuchtung_informationen_und_westeck_led__df_

Tv insert

how to insert instead of {PAGENO} in ["<div align='right' style='font-size: 8pt;'>{PAGENO}</div><div align='center' style='font-size: 8pt; font-style: italic;'><hr>My footer text.</div>"] - Template Variables modx revo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.