4

I'm using mPDF library to provide pdf files.

Assume that I have a file named facture.php that contains :

  • an image in the header

  • a table in the body

  • an image in the footer of the file

And another file named convert_HTML2PDF.php that will provide the pdf output of the first file.

I would like to get the output of the facture file that is interpreted into a variable and output it as a pdf file without visualising in the browser.

How can I do that and use the output inside the convert_HTML2PDF.php?

1
  • Why not include the functionality of convert_HTML2PDF.php in your script? Commented Aug 30, 2013 at 17:42

3 Answers 3

10
$pdf = $mpdf->Output('', \Mpdf\Output\Destination::STRING_RETURN)

will output the PDF into a string - no need to create temp file.

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

Comments

2

Use file_get_contents() to get html content of your facture.php :

$output = file_get_contents('http://www.example.com/facture.php');

1 Comment

I used this function and it works, but now, the problem is that in the facture.php there is two images that have not been displayed ! When i access locally facture.php the images are displayed.
0
$mpdf->Output('filename.pdf', 'F');

will send the output to a file on your server instead of a browser.

See: http://mpdf1.com/manual/index.php?tid=125 For more output variations.

Comments

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.