jako / pdfresource Goto Github PK
View Code? Open in Web Editor NEWConvert resources to PDF in MODX Revolution
Home Page: https://jako.github.io/PDFResource/
License: GNU General Public License v2.0
Convert resources to PDF in MODX Revolution
Home Page: https://jako.github.io/PDFResource/
License: GNU General Public License v2.0
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?
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
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.
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?
It is necessary to generate the hidden pdf the file (at manual addition in the end of his name of any symbol - for example - b) and this pdf the file - with other template - without header and a footer
To have a look as it has to look possible here
http://www.azimutyachts.ru/boat-spec-331-2.pdf
http://www.azimutyachts.ru/boat-spec-331-2-b.pdf
is it possible?
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.
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
paremetr pdfresource.mgh don't worked
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?
It works with the "web" context fine, but I can't seem to get it to produce anything for other custom contexts.
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?
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 :-(
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.
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.
Do tv parameters work in pdfresource.SetHTMLFooter or pdfresource.SetHTMLHeader?
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 :-)
Hi, is it possible to change the standard PDF folder from assets/pdf/ to a custom folder e.g. assets/client/pdf? Where to hack this - there is no system setting, right?
Thanks very much!
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/
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?
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.
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;
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!
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
Hi,
I have a resource with embedded images.
After moving to a new server, I see a small red "x" instead of the images.
This is how it should look like:
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!
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.
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'.
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:
When I unchecked the Create Pdf checkbox it still did not work.
When I removed pdfresource from the template the resource saved without issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.