Unable to generate second page of pdf using wkhtmltopdf Php - wkhtmltopdf

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}

Related

Generate PDF from HTML page made with Bootstrap and ChartJS in Laravel

My web app is running under Laravel 6.
In this app, I have a html page that is accessible through an URL but I also want to download this exact same page. The page is made with Bootstrap 4 and has charts using ChartJS lib.
When I try to download as PDF (thanks to Dompdf for Laravel) the exact same page, I get the following error message :
No block-level parent found. Not good.
added in the config/dompdf.php
"enable_html5_parser" => true,
I ended up using WKHTMLTOPDF and generating images corresponding to the charts before (browser side). Fastest solution for me :)

wkhtmltopdf not get https images on laravel

I am using Laravel 5.2 and I use wkhtmltopdf (snappy PDF) for get html to pdf.
For html to PDF it work perfect with internal image and external images with http urls.
like I use http://extradomain.com/logo.png work perfect there is no problem to load image on PDF file. but when I use https like https://exaple.com/logo.png its not working at all.
I tried with :
$pdf->setOption('isRemoteEnabled',true);
but there is error of function not found and its not working.
how can I rander images from https ?

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.

Laravel-dompdf not generating datatables for serverside data

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.

PDF Generation from HTML using bootstrap css

Can we able to generate a pdf from HTML page , where we are using two css files Style.css and bootstrap.css. Is it is feasible to render html page to pdf as it is displayed in the UI.
Yes, we can generate a pdf from HTML page.You can generate your html page using phantom.js which provides a Javascript API to generate .pdf ,.png,.jpg etc of any static HTML page.Static page means single .html page where resources also included.The steps are as follow:
Download phantomjs-2.0.0-windows.zip from http://phantomjs.org/download.html.
Go to the C:\Users\USER\Downloads\phantomjs-2.0.0-windows\phantomjs-2.0.0-windows\bin ,{C:\ where library downloaded}
3.open a terminal and jump to C:\Users\USER\Downloads\phantomjs-2.0.0-windows\phantomjs-2.0.0-windows\bin>
type a command on terminal: phantomjs {refer rasterize.js} "your static html page url" {target dirctory/file.extension}
for example>C:\Users\USER\Downloads\phantomjs-2.0.0-windows\phantomjs-2.0.0-windows\bin> phantomjs ../examples/rasterize.js "http://phantomjs.org/download.html" abc.pdf

Resources