html - How to detect end of page for PDF in php (laravel)


I have the following php code that converts html blade and show it on PDF file:

public function generatePDF(Request $request)
    $html_content = $view->render();
    PDF::writeHTML($html_content, true, false, true, false, '');
    PDF::Output('myPDF.pdf'); }

$view is a laravel blade takes many paragraphs(string) with different lengths form database then the previous code show them on PDF file in a specific pattern.

What i want is to guarantee that no paragraph will split between two pages, for example if there is a paragraph of 4 lines and only two lines remains from the first page, then the whole paragraph should start from the second page.




i think you should need to use this package instead for better library when dealing with PDF.

This is quite most developers has been using on the PDF development to every projects and even simpler to integrate and use.

For hard core solution, you may use this library but you need to code in a native PHP coding. Here is the online doc of the Library.

People are also looking for solutions to the problem: Most popular PHP proxy scripts


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.