Laravel-dompdf not generating datatables for serverside data - ajax

I'm having problem with generating pdf using dompdf.
I'm using following code to generate the pdf:
$pdf = PDF::loadView('myview', compact('data', 'data2'));
return $pdf->stream($file_name . '.pdf');
It's generating pdf but the problem is datatable. Apart from this data showing on the page there is a datatable in the view which has serverside ajax call to generate datatable.
Dompdf is not generating thos data when it creats pdf file.
Any help would appreciated.
Thank you,

Dompdf does not support javascript while rendering, so it will never execute that ajax call to populate datatable.
From dompdf wiki page
inline PDF Javascript support (with scripts compatible with the PDF Documents API)
That means that javascript will be embedded in the PDF, and that you can use JavaScript for Acrobat API Reference. You can also look into javacript for acrobat.
However,some of the PDF viewers might not support all of the API.
So, in your case, you need to create a new view that renders the table without using the javascript.

Related

Render CKEditor Data in Vue JS

I need to render my CKEditor Data on my web page but it's not happening as I am using vuejs, which does not refresh the page it just replaces the components.
My CKEditor data also contain MathML Formulas.
Need to load it dynamically from the rest API.
Example of data that is stored as the output of CKEditor
<p><math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mrow><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo></mrow><mn>2</mn></msup><mo>=</mo><msup><mi>a</mi><mrow><mn>2</mn></mrow></msup><mo>+</mo><mn>2</mn><mi>a</mi><mi>b</mi><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></math></p>
rendering MathML can be done using the CDN
https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
but this thing works on page refresh and because VueJS is SPA it does not work there.
I want to render the formula in my , not in the CKEditor.
I have got the formula mentioned as an output of CKEditor but now want to display it on a normal webpage of vuejs

Laravel - Rendering a section of a view to PDF using domPDF

I have a Laravel 6 app and am using laravel-domPDF elsewhere in my app just fine. However, I want to create a PDF from a section of the view page. I have the HTML I need rendered-out stored in a variable, but the code to render out the HTML is PHP and I can't execute PHP from a button on the view page without a reload of the page, which loses the variable.
I have a controller just to render out the HTML, but can't find a way to pass that large HTML string to the controller from the view. I can't pass it via a route as it sends the HTML as a parameter attached to the URL and apart from looking terrible, it doesn't work.
How can I get a section of HTML in my view into the following PHP to render the PDF using a button on my view?
$pdf = App::make('dompdf.wrapper');
$pdf->loadHTML($table_html_pdf);
return $pdf->stream();

Unable to generate second page of pdf using wkhtmltopdf Php

Hi,
I have generated the HTML from PDF using conversion tool pdftohtmlEx, Then I am trying to convert this HTML to Pdf by using wkhtmltopdf
Problem i am facing is when HTML has more than one page, it is not generating same number of Pdf pages as like HTML i have.
Here is the result
Finally Resolved the issue, I have replaced following style generated by pdf2htmlEx
page-container{bottom:0;right:0;overflow:auto} with
.pf{margin:0;box-shadow:none;page-break-after:always;page-break-inside:avoid}

I'm generating a pdf with laravel-dompdf and I am using server path to show images in the pdf. Is it secure?

I am using laravel-dompdf to generate a pdf but to show images in that pdf I tried the route and controller approach but it's working for webpage but not for pdf. That's I am using the server path (/home/shashank/work/jobs/storage/app/{{$photo}}).
I want to know if it's safe or not.

Generate PDF from view using iTextSharp

My requirement is to have a button in my view and clicking on that should generate a PDF report from that view. (Should avoid making another trip to database to get data for the PDF report).
I decided to use iTextSharp. Could some body please post some examples or direct me to a proper article?
I answered something similar on this link.
You will need to sort out the caching of the data from the DB though, this version just queried it again.
How to make a pdf report of a particular view in mvc3

Resources