mplodowski / dynamicpdf-plugin Goto Github PK
View Code? Open in Web Editor NEWhttps://octobercms.com/plugin/renatio-dynamicpdf
Home Page: https://octobercms.com/plugin/renatio-dynamicpdf
License: MIT License
https://octobercms.com/plugin/renatio-dynamicpdf
Home Page: https://octobercms.com/plugin/renatio-dynamicpdf
License: MIT License
chinese characters become ???
I tried to set the utf-8 meta but still didn't work.
maybe it's setfont problem
Hello,
In the screen shots and the demo the the PDF Options are inside Settings but on installing the plugin is creating a custom Menu icon.
Can this be moved back into the settings?
First, I noticed it is not really possible to call an image from October resources with something like
<img src="{{ 'path_to_image/image.jpg'|theme }}">
which is a pity.
I needed to put a logo on my invoice template, but not as a whole background image, so I put my logo image in the body like:
<div class="header">
<p class="left"><img src="{{ background_img}}"></p>
And it was visible in the HTML preview, but it reported "unknown type or image not found" in PDF.
After browsing google and stackoverflow, I took the absolute url of the image like this:
<img src="./storage/app/uploads/public/581/b8d/a3e/581b8da3ef870347781077.png">
Now, when there is no dot "./" at the beginning, the image is visible in the HTML preview, but not in PDF preview, but when I put the dot, it is not visible in the HTML preview, but visible in the PDF preview.
a couple days ago my PDF layout and template is working good. So today when i create the new template and preview it is return error like this:
PS: I never touch anythings
DOMDocument::loadHTML(): Unexpected end tag : span in Entity, line: 799 DOMDocument::loadHTML(): Unexpected end tag : small in Entity, line: 799 DOMDocument::loadHTML(): Unexpected end tag : span in Entity, line: 835 DOMDocument::loadHTML(): Unexpected end tag : small in Entity, line: 835 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1181 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1183 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1194 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1200 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1203 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1210 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1216 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1216 DOMDocument::loadHTML(): Unexpected end tag : p in Entity, line: 1221 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1267 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1269 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1269 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1271 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1271 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1273 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1275 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1281 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1285 DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 1332
Thank you!
PHP 7.3
Plugin version 3.0.3
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
...\plugins\renatio\dynamicpdf\vendor\dompdf\dompdf\src\Dompdf.php line 610
Edit: temporary solution is to downgrade "barryvdh/laravel-dompdf" to "0.8.1" version
On the blog page content, there is a video added. while creating an pdf using this plugin, the video thumbnail will be not shown on the generated PDF file.
Hey guys thank you for this great plugin.
I have a question...
How i can use my model relationship?
For example:
public $attachMany = [
'images' => ['System\Models\File', 'public'=>true]
];
This is not working: {{images}}
Any idea?
Thank you!
Hi Renatio,
When I try to use {% partial 'partialname' %} in a template, I get an error report saying
Unknown "partial" tag in "__string_template__4ebf2d420e6d5528cee7cb511aa2ca8a26fa9f5e2dacf238bf2e9a3cc805edbb" at line 19.
*path*\vendor\twig\twig\lib\Twig\Parser.php line 158
Is there any way or workaround so I can use partials in DynamicPDF?? I'm on build 434 by the way.
Hello,
After installing the plugin from the backend this error shows up:
"Class 'Barryvdh\DomPDF\ServiceProvider' not found"
What can I do?
Hi there, thanks for the great plugin. I'm getting this issue on some hosting (not every):
exception 'ErrorException' with message 'file_exists(): open_basedir restriction in effect. File(/tmp//log.htm) is not within the allowed path(s): (/usr/local/www/data/:/var/tmp)' in /usr/local/www/data/mysite.cz/www/plugins/renatio/dynamicpdf/vendor/dompdf/dompdf/src/Dompdf.php:699
In my User export PDF plugin I fixed that by explicit setting of logOutputFile
: vojtasvoboda/oc-userexportpdf-plugin@34e07dd
But when I'm using only your plugin separately, I'm having same error when I click on PDF template > Preview.
So I just want to let you know.
can you please share some examples of embedding SVG images using URL or SVG XML structure in HTML to generate PDF ?
Hello,
How can I display display the pdf in form preview in the backend?
I want to create PDF with header contain some address text and information on pages of pages in PDF (like 1/10 pages), and below that i want to put some long content generated from data by twig for ...
and have issue that after auto content page brake, on next page content is placed over the header at top of page :/
and second thing... page numbers - how to get them ?
Hi! Strange bug in Chrome: if I chain PDF::loadTemplate(...)->save()->stream() - the file looks corrupted, always different lines but always corrupted. Here is the code, what am I doing wrong? My PDF is in Cyrillic, Dejavu Sans, I don't know if it can make any difference. I tried other fonts - same result. Without save() in chain - everything ok.
$user = Auth::getUser();
$offer = $user->kp;
if ($offer) {
$orientation = $offer->orientation;
$filename = Str::slug($user->company . '_' . $offer->client_name) . '.pdf';
return PDF::loadTemplate('offer::classic', compact('user','offer'))
->setPaper('a4', $orientation)
->setOptions([
'logOutputFile' => storage_path('temp/log.htm'),
'isRemoteEnabled' => true,
])
->save($filename)
->stream();
}
While the saved file looks totally ok, the streemed version on frontend is not: here is printscreen http://joxi.ru/a2XzoZXc1MDWBr and here is the file
smartpx-p-ooo-vilki-i-lozhkip.pdf
It's not a big problem - I can save the file and then redirect to it but I wonder why? It's in documentation:
You can chain the methods: return PDF::loadTemplate('renatio::invoice') ->save('/path-to/my_stored_file.pdf') ->stream();
Hello,
since i updated octobercms to the latest version with php7 in generating the pdf it comes out this error:
Imagick::clone method is deprecated and it's use should be avoided
the problem occurs when there is a picture
are there any solutions please?
thank you so much
It would be useful to be able to inspect the HTML/CSS using browser developer tools to experiment with HTML and CSS when creating a new layout or template.
Is there anyway to accomplish that, even programmatically?
Hi,
how to set pdf response to get PDF on CMS PAGE, where is defined function onInit?
Hi
Thanks for the plugin.
I need some help please with how to create a download. I am displaying a web page with a download button. This is executing a method in my component that runs
return PDFTemplate::render($templateCode, $data, $params);
But I want to download rather than display the pdf. Can you help please? Thanks
Hi
I'd love to use your pdf-plugin but it renders a different aspect ratio than A4, probably 'Letter'. How can we change this ratio in the output?
Background image with proper params (96DPI, approx 794x 1123px) and PDF result was deformed, with scaled image, not to full page but with margin on right side, and image was not at full page, but it overflows at bottom of page. some help or info?
I got an "A non-numeric value encountered" error which is already described and should be fixed at the php-svg-lib where the error occurs? Can you updated your pluing so it include the latest changes.
Thanks
Getting the below error message randomly when attempting to run any basic laravel commands:
[2018-05-10 12:43:58] dev.ERROR: ErrorException: Undefined index: DOMPDF_FONT_CACHE in /Users/jack/Work/sites/psg/plugins/renatio/dynamicpdf/classes/ServiceProvider.php:33
Tried looking around and found issue #1260 but none of the resolutions/fixes mentioned there seem to fix the issue that I'm having.
Already tried:
Deleting vendor folder & running composer update
Deleting /storage/fonts directory content
composer dump-autoload
composer dump-autoload -o
Changed all references of DOMPDF_FONT_CACHE to font_cache which appears to have fixed the issue, but don't think it's ideal.
I try open pdf using ajax, but don`t open it
public function onPDF(){
try {
$template = Template::find(1);
$texto = post('revisao');
$templateCode = 'renatio::invoice'; // unique code of the template
$template->update(['content_html'=> $texto]);
// return PDF::loadTemplate($templateCode, $data)->save('download.pdf')->download('download.pdf');
return PDF::loadTemplate($templateCode, [])
->setOptions(['isRemoteEnabled' => true])
->stream('download.pdf');
} catch (\Exception $e) {
return $e->getMessage();
}
}
Hi,
Thanks for this great plugin!
On my first attempt to deploy it in production using OctoberCMS build 345
I could not install the plugin.
The following error message was displayed during the installation process:
Update failed
{"#layout-flash-messages":
" <p data-control=\"flash-message\" class=\"flash-message fade error\"
data-interval=\"5\">The Code has already been taken.<\/p>\n",
"X_OCTOBER_ERROR_FIELDS":{"code":["The Code has already been taken."]}}
After that the OctoberCMS backend login is broken with the same error message.
After removing the plugin from the command line:
php artisan plugin:remove Renatio.DynamicPDF
and delete the plugins/renatio
folder I made a new attempt to install the plugin with:
php artisan plugin:install Renatio.DynamicPDF
This time with the following exception is thrown:
[ErrorException]
mkdir(): File exists
More details here: octobercms/october#2111
Any ideas on how to get the plugin working with my current OctoberCMS build 345
?
Hi,
I am wondering why the file won't download during an ajax call, in my component ;
public function onExportPDF(){
return PDF::loadTemplate('renatio::invoice')->download();
}
The response is always returned as a string - Response headers ;
Cache-Control:no-cache
Connection:Keep-Alive
Content-Disposition:attachment; filename="document.pdf"
Content-Type:application/pdf
Date:Mon, 17 Jul 2017 02:54:26 GMT
Keep-Alive:timeout=5, max=100
Server:Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/7.1.4
Transfer-Encoding:chunked
X-Powered-By:PHP/7.1.4
When I use save
method, CSS content is not added to PDF like using stream
method.
save
method$view = View::make(
'planetadeleste.payslip::pdf.invoice_report_header',
[
'business' => $business,
'process' => ['name' => $this->trans('Reporte MTSS')]
]
);
PDF::loadLayout('report', ['content_html' => $view])->save($pdfCoverPath);
stream
method$view = View::make(
'planetadeleste.payslip::pdf.invoice_report_header',
[
'business' => $business,
'process' => ['name' => 'Reporte MTSS']
]
);
return PDF::loadLayout('report', ['content_html' => $view])->stream($pdfCoverFilename);
Hi Renatio,
I'm having trouble with images inside PDF. When I'm trying this code in template:
{% set config = {mode: 'crop', extension: 'auto'} %}
<img src="{{ user.avatar.getThumb(260, 260, config) }}" alt="" />
it gets me this PDF:
I have tried to debug template output by this snippet:
$pdf = App::make('dynamicpdf');
$user = UserModel::find(1);
$template = Template::byCode('rainlab::user');
dd($pdf->parseTemplate($template, compact('user')));
And it returns correct code with correct image path:
This code definitely works in previous versions, because I'm using it at User PDF export plugin and I also make some screenshots for plugin page, where user avatars are shown.
Do you know, where could be a problem please? Tried on latest October build 419 with Laravel 5.5.
Thank you very much!
Vojta
error trying do pdf
file_exists(): open_basedir restriction in effect. File(/tmp/log.htm) is not within the allowed path(s)
I'm rendering PDF's with this plugin but I noticed that for example {{ 'Price'|_ }} is not working.
Any plans to make this working with rainlab.translate plugin?
Cheers
does not work with the new version. Errors during installation
It would be great to have an interface for other plugins to register PDF templates in a similar way to registering mail templates. For instance, a method like the following in your Plugin.php
file:
public function registerPdfTemplates() {
return [
'vendor.plugin::pdf.template' => "PDF Description",
];
}
I have already begun work on this and would like to open a PR soon, but I wanted to open this as an issue for tracking purposes, and to invite feedback/suggestions.
The direct path generated with the {{ url }} / to my image is working fine.
but i does not showig up. i get "Image not found or type unknown" and a outlined box.
local enviromet works fine.
app/config.php has the correct server name too.
any help would be appreciated
how to use $data in template. {{data.name}} or {{this.data.name}} how to do? sorry my bad english
The demo site contains the older version of DynamicPDF (maybe v2.1.1). If you have free time, please update it.
Hey, its a way to set default paper size in layout?
Hi guys, I'm getting this error from one of the vendor files
A non-numeric value encountered /Users/abel/Sites/myboilie/plugins/renatio/dynamicpdf/vendor/dompdf/dompdf/src/Positioner/Fixed.php line 56
Hi,
Sounds impossible to set page margin to zero; I always get a ~1cm margin in every border of the page.
I tried :
@page {
margin: 0 !important;
padding: 0 !important;
}
body{
margin:0 !important;
padding: 0 !important;
}
html{
margin:0 !important;
padding: 0 !important;
}
*{
margin:0 !important;
padding:0 !important;
}
Any idea ?
Hi there, how do we read the page number generated and display it in the PDF?
Thanks
With DynamicPDF installed: updating system, plugins, or logging into the backend of October throws a "Too much recursion" error. Can't seem to narrow down. As soon as I uninstall DynamicPDF, error goes away. Any thoughts?
Hi there,
we're trying to install this plugin by CLI, since we are creating an install script with the help of offline/oc-bootstrapper.
During the plugin-installation by CLI with the standard command php artisan plugin:install Renatio.DynamicPDF
we're receiving the following error (which we don't get during manual/backend install:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Barryvdh\DomPDF\ServiceProvider' not found
is there any idea why?
Can someone reproduce this problem?
We could reproduce it in three different working environments (Mac, MAMP and homestead).
Also, after CLI-installation the whole site will be throwing this error.
It seems that the migrations were working, but somehow something is missing.
Any hints?
Thank you!
Hello,
Im calling a function to generate the PDF, via an ajax call to a function. That function pulls in data ready to pass to the pdf template file. When the button is clicked I can see that the request headers are updating however there is no pdf being output either using download() or stream()
I have the below in a component class
` public function onGeneratePDF()
{
$model = new ProductType();
$templateCode = 'technical-data-sheet'; // unique code of the template
$this->data = ['name' => 'John Doe'];
return PDF::loadTemplate($templateCode, $this->data)->download();
}`
and this in a component partial
<a href="" data-request="{{__SELF__}}::onGeneratePDF" target="_blank">PDF</a>
I am running php 7.1 so I updated dompdf to version 0.8.0
Can I pull the html for the PDF and use it for emails as well?
if(!empty($pdf)){
return PDF::loadTemplate('my-farewell-wishes', $data)->download('myfarewellwishes.pdf');
}
if(!empty($sendEmial)){
$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>``
. return PDF::loadTemplate('my-farewell-wishes', $data); //add the html here <----
It seems like the backend menu for this plugin should live under the Settings screen rather than on the main navigation menu, and maybe layout the UI to match the Mail templates section as well. If this would be desired, I'd be willing to make these changes and open a PR for it.
I'm trying to set a custom paper size for printing a sticker but I can't manage to change the size. I understand I need the setPaper method but I'm just getting the default A4 size. Also, trying a different standard paper size, available in CPDF.php returns A4.
PDF::setPaper([0,0,164,187], 'portrait');
return PDF::loadTemplate('myboilie.orders::nl.sticker', $data)->stream();
Thank you for that very useful Plugin!
is there a Possibility to attach/save a generated PDF to a Model? (this would be done through a monthly recurring scheduled task)
in my Model Class I have declared a
public $attachOne = [
'pdf' => ['System\Models\File', 'public' => false]
];
and inside Console Class - handle(), which is called through Scheduler, i have
$pdf = PDF::loadTemplate($templateCode, $data);
$invoice = Invoice::create([
'invoice_no' => $invoice_no,
'customer_id' => $customer->id,
'amount' => $sum,
'status' => 'offen',
'updated_at' => Carbon::now(),
'created_at' => Carbon::now(),
'pdf' => $pdf->output()
]);
tried several things .. couldn`t get it to work that pdf gets stored in DB Table 'system_files'
Helpful advice would be very nice,
thank you
Emil
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.