Giter Club home page Giter Club logo

dynamicpdf-plugin's People

Contributors

gergo85 avatar guicaires avatar kocholes avatar larrybarker avatar matissjanis avatar mplodowski avatar purposebuiltscott avatar samuell1 avatar timfoerster avatar vojtasvoboda avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

dynamicpdf-plugin's Issues

Remove from Backend Menu

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?

Embedding images into template

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.

annoying error

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!

Compatibility issue with php 7.3

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

Video thumbnail could not generated

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.

Relationship..how?

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!

How to use partials in DynamicPDF

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.

Installation problem

Hello,

After installing the plugin from the backend this error shows up:

"Class 'Barryvdh\DomPDF\ServiceProvider' not found"

What can I do?

Open_basedir restriction

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.

Header on every page and long content splitted over pages

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 ?

Save()->stream() chaining make parts of lines in generated PDF disappear

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();

Imagick::clone method is deprecated

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

PDF in CMS page

Hi,

how to set pdf response to get PDF on CMS PAGE, where is defined function onInit?

PDF Download

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

How to set PDF to render A4

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?

Full page background image

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?

Undefined index: DOMPDF_FONT_CACHE

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.

open pdf using ajax

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();
        }
    }

Backend login broken after attempt to install. Error "The Code has already been taken" -

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?

Force download via AJAX

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

Queued PDF job doesn't add CSS styles

When I use save method, CSS content is not added to PDF like using stream method.

Using 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);

Pdf Render

image

Using 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);

Pdf Render

image

[L5.5] Plugin doesn't generate images

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:

snimek obrazovky 2017-07-28 v 16 10 53

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:

snimek obrazovky 2017-07-28 v 16 07 20

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

This plugin does not translate strings

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

Allow plugins to register PDF templates

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.

Imag Path on Server (question)

I having trouble getting an Image working on my server.

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

use $data in template

how to use $data in template. {{data.name}} or {{this.data.name}} how to do? sorry my bad english

Update the demo site

The demo site contains the older version of DynamicPDF (maybe v2.1.1). If you have free time, please update it.

Error in vendor file

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

Can't set page margin to 0

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 ?

Too much recursion

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?

php artisan plugin:install Renatio.DynamicPDF not working

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!

Request Headers updating but no pdf

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

Use the HTML for emails

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 <----

Move backend menu to Settings

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.

Can you provide an example how to set paper size?

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();

Storing PDF to Model

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

Permission denied

I'm using window 7 and I had full permission but when I use preview button on templates backend it show message.

unlink(C:\Users\lvthu\AppData\Local\Temp/04
untitled
b854edea2a8e08d8007d212360ace1): Permission denied

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.