Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:16:29+00:00 2026-06-13T03:16:29+00:00

I found this library to convert HTML to PDF : dompdf . The example

  • 0

I found this library to convert HTML to PDF: dompdf.

The example source code looks like this:

<?php   
    require_once("dompdf/dompdf_config.inc.php");
    $html =
      '<html><body>'.
      '<p>Put your html here, or generate it with your favourite '.
      'templating system.</p>'.
      '</body></html>';

    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream("sample.pdf");
?>

Is there a way to import a PHP output into this code?

Or is there a better way to convert a PHP output to PDF?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:16:30+00:00Added an answer on June 13, 2026 at 3:16 am

    You can use Output Buffers to achieve this as well. I’ve used this with DOMPDF in the past.

    /* Use output buffer capture */
    ob_start();
    require_once "Renderer.php";
    $layoutHTML = ob_get_contents();
    ob_end_clean();
    

    $layoutHTML will have the processed HTML.

    And then you can use DOMPDF the way you’ve described in your question

     $dompdf->load_html($html);
    

    Careful that this can chew a lot of memory (depending on the problem of course).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to learn the Enterprise Library. I found this useful code sample to
This morning we found an old chunk of code that was causing a library
I have this code, that i found on this website http://msdn.microsoft.com/en-us/library/efx1fwb6.aspx <asp:DataList runat=server ID=Datalist1
I found this library and liked it. Know i am searching info how to
I'm trying to authenticate user accounts in Windows Phone. I found this C# library
I am learning how to draw GUI's with GDI/GDI+, i found this http://msdn.microsoft.com/en-us/library/windows/desktop/dd756596(v=vs.85).aspx#step_2__declare_that_the_application_is_dpi-aware Does
This is from a small library that I found online: const char* GetHandStateBrief(const PostFlopState*
found this little code snippet that seems to do what i want, but im
I am using EmguCV in WPF and i found this example tp capture image
Using PHP, I'd like to convert a string containing a Roman number into its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.