0

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,

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

but there is a option in config/dompdf.php where I can set DOMPDF_ENABLE_JAVASCRIPT = true, this option says enable inline javascript. if this settings is set to true than DOMPDF will detect scripts that includes type="text/javascript". But still no luck.
Thanks... i've moved the view in a different page where I'm not using any javascript.
I'm glad I could help. If this answered your question, please consider accepting the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.