Virajsinh

DOMPDF For PhP

Apr 7th, 2023 (edited)
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | Source Code | 0 0
  1. <?php
  2.     // Download Library https://github.com/dompdf/dompdf/releases Or Use PhP Composer
  3.     // Refer : https://stackoverflow.com/questions/15153139/dompdf-remote-image-is-not-displaying-in-pdf
  4.     // Use Any Image For Directly Not Work Then Use base64_encode Function. URL Or Server Folder Path Both Work
  5.     $profile_image = "data:image/png;base64,".base64_encode(file_get_contents(IMAGE_URL/FOLDER_PATH)); 
  6.  
  7.     $dompdf = new Dompdf();
  8.     $dompdf->loadHtml($htmldata);
  9.     $dompdf->render();
  10.     $output = $dompdf->output();
  11.     file_put_contents($path.'pilot_onboarding.pdf', $output); // Generate Specific Location
  12.     // $dompdf->setPaper('A4', 'landscape');
  13.     // $dompdf->stream("Brochure.pdf",array("Attachment" => false)); // Preview Use
  14. ?>
Add Comment
Please, Sign In to add comment