{"id":4690,"date":"2021-08-06T16:15:04","date_gmt":"2021-08-06T16:15:04","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=4690"},"modified":"2021-08-06T16:16:29","modified_gmt":"2021-08-06T16:16:29","slug":"convert-html-to-pdf-in-laravel-with-dompdf","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/","title":{"rendered":"Convert HTML to PDF in Laravel with Dompdf"},"content":{"rendered":"<p>PDF is a commonly used format to store data in a file for offline uses. If you want to allow the user to download HTML content in a PDF file, HTML to PDF conversion functionality needs to be implemented in the web application. The Dompdf library can be used to <a href=\"https:\/\/www.codexworld.com\/convert-html-to-pdf-php-dompdf\/\">convert HTML to PDF using PHP<\/a>.<\/p>\n<p>The Dompdf is a PHP library that helps to convert HTML to PDF document. If your application is built with Laravel, the Dompdf library is the best option to create a PDF file and add HTML content to PDF document. In this tutorial, we will show you how to <b>convert HTML to PDF in Laravel<\/b> with Dompdf.<\/p>\n<h2>Convert HTML to PDF in Laravel<\/h2>\n<p>Run the following command to install Dompdf via Composer in your Laravel application.<\/p>\n<pre>composer require dompdf\/dompdf<\/pre>\n<p>For this example, we will use the <code>convert()<\/code> method of the HomeController to convert HTML content to PDF document.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>At first, define the reference the Dompdf namespace.<\/li>\n<li>In the <code>convert()<\/code> method, add the code to handle the HTML to PDF conversion process.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php <br \/> <br \/><\/span><span style=\"color: #007700\">namespace&nbsp;<\/span><span style=\"color: #0000BB\">App<\/span><span style=\"color: #007700\">\\<\/span><span style=\"color: #0000BB\">Http<\/span><span style=\"color: #007700\">\\<\/span><span style=\"color: #0000BB\">Controllers<\/span><span style=\"color: #007700\">; <br \/> <br \/>use&nbsp;<\/span><span style=\"color: #0000BB\">App<\/span><span style=\"color: #007700\">\\<\/span><span style=\"color: #0000BB\">Http<\/span><span style=\"color: #007700\">\\<\/span><span style=\"color: #0000BB\">Controllers<\/span><span style=\"color: #007700\">\\<\/span><span style=\"color: #0000BB\">Controller<\/span><span style=\"color: #007700\">; <br \/> <br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Reference&nbsp;the&nbsp;Dompdf&nbsp;namespace <br \/><\/span><span style=\"color: #007700\">use&nbsp;<\/span><span style=\"color: #0000BB\">Dompdf<\/span><span style=\"color: #007700\">\\<\/span><span style=\"color: #0000BB\">Dompdf<\/span><span style=\"color: #007700\">; <br \/> <br \/>class&nbsp;<\/span><span style=\"color: #0000BB\">HomeController&nbsp;<\/span><span style=\"color: #007700\">extends&nbsp;<\/span><span style=\"color: #0000BB\">Controller <br \/><\/span><span style=\"color: #007700\">{ <br \/>&nbsp;&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">convert<\/span><span style=\"color: #007700\">() <br \/>&nbsp;&nbsp;&nbsp;&nbsp;{ <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Instantiate&nbsp;and&nbsp;use&nbsp;the&nbsp;dompdf&nbsp;class <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$dompdf&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;new&nbsp;<\/span><span style=\"color: #0000BB\">Dompdf<\/span><span style=\"color: #007700\">(); <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Load&nbsp;HTML&nbsp;content&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$dompdf<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">loadHtml<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'&lt;h1&gt;Welcome&nbsp;to&nbsp;CodexWorld.com&lt;\/h1&gt;'<\/span><span style=\"color: #007700\">);&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;(Optional)&nbsp;Setup&nbsp;the&nbsp;paper&nbsp;size&nbsp;and&nbsp;orientation&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$dompdf<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">setPaper<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'A4'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'landscape'<\/span><span style=\"color: #007700\">);&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Render&nbsp;the&nbsp;HTML&nbsp;as&nbsp;PDF&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$dompdf<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">render<\/span><span style=\"color: #007700\">(); <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Output&nbsp;the&nbsp;generated&nbsp;PDF&nbsp;(1&nbsp;=&nbsp;download&nbsp;and&nbsp;0&nbsp;=&nbsp;preview) <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$dompdf<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">stream<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"welcome.pdf\"<\/span><span style=\"color: #007700\">,&nbsp;array(<\/span><span style=\"color: #DD0000\">\"Attachment\"<\/span><span style=\"color: #007700\">=&gt;<\/span><span style=\"color: #0000BB\">1<\/span><span style=\"color: #007700\">)); <br \/>&nbsp;&nbsp;&nbsp;&nbsp;} <br \/>&nbsp;&nbsp;&nbsp;&nbsp; <br \/>} <br \/><\/span><\/pre>\n<h2>Conclusion<\/h2>\n<p>This HTML to PDF converter script provides a simple way to <b>create a PDF document with dynamic content in Laravel 8<\/b>. You can use this example code in any version of Laravel Framework as well as Lumen. There are various configurations are available in Dompdf to customize the PDF creation functionality as per your needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PDF is a commonly used format to store data in a file for offline uses. If you want to allow the user to download HTML content in a PDF file, HTML to PDF conversion functionality <\/p>\n","protected":false},"author":1,"featured_media":4692,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[272],"tags":[180,179,271,181],"class_list":["post-4690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-dompdf","tag-html","tag-laravel","tag-pdf","cat-272-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Convert HTML to PDF in Laravel with Dompdf - CodexWorld<\/title>\n<meta name=\"description\" content=\"HTML to PDF in Laravel - Example code to create PDF and add dynamic content to PDF document in Laravel with Dompdf. Use the Dompdf library to convert HTML to PDF in Laravel 8.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Convert HTML to PDF in Laravel with Dompdf - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"HTML to PDF in Laravel - Example code to create PDF and add dynamic content to PDF document in Laravel with Dompdf. Use the Dompdf library to convert HTML to PDF in Laravel 8.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-06T16:15:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-06T16:16:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2021\/08\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Convert HTML to PDF in Laravel with Dompdf\",\"datePublished\":\"2021-08-06T16:15:04+00:00\",\"dateModified\":\"2021-08-06T16:16:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/\"},\"wordCount\":235,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png\",\"keywords\":[\"Dompdf\",\"HTML\",\"Laravel\",\"PDF\"],\"articleSection\":[\"Laravel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/\",\"name\":\"Convert HTML to PDF in Laravel with Dompdf - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png\",\"datePublished\":\"2021-08-06T16:15:04+00:00\",\"dateModified\":\"2021-08-06T16:16:29+00:00\",\"description\":\"HTML to PDF in Laravel - Example code to create PDF and add dynamic content to PDF document in Laravel with Dompdf. Use the Dompdf library to convert HTML to PDF in Laravel 8.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"convert-html-to-pdf-in-laravel-with-dompdf-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-laravel-with-dompdf\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Convert HTML to PDF in Laravel with Dompdf\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Convert HTML to PDF in Laravel with Dompdf - CodexWorld","description":"HTML to PDF in Laravel - Example code to create PDF and add dynamic content to PDF document in Laravel with Dompdf. Use the Dompdf library to convert HTML to PDF in Laravel 8.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/","og_locale":"en_US","og_type":"article","og_title":"Convert HTML to PDF in Laravel with Dompdf - CodexWorld","og_description":"HTML to PDF in Laravel - Example code to create PDF and add dynamic content to PDF document in Laravel with Dompdf. Use the Dompdf library to convert HTML to PDF in Laravel 8.","og_url":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2021-08-06T16:15:04+00:00","article_modified_time":"2021-08-06T16:16:29+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2021\/08\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Convert HTML to PDF in Laravel with Dompdf","datePublished":"2021-08-06T16:15:04+00:00","dateModified":"2021-08-06T16:16:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/"},"wordCount":235,"commentCount":0,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2021\/08\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png","keywords":["Dompdf","HTML","Laravel","PDF"],"articleSection":["Laravel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/","url":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/","name":"Convert HTML to PDF in Laravel with Dompdf - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2021\/08\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png","datePublished":"2021-08-06T16:15:04+00:00","dateModified":"2021-08-06T16:16:29+00:00","description":"HTML to PDF in Laravel - Example code to create PDF and add dynamic content to PDF document in Laravel with Dompdf. Use the Dompdf library to convert HTML to PDF in Laravel 8.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2021\/08\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2021\/08\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png","width":1366,"height":768,"caption":"convert-html-to-pdf-in-laravel-with-dompdf-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-laravel-with-dompdf\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Convert HTML to PDF in Laravel with Dompdf"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2021\/08\/convert-html-to-pdf-in-laravel-with-dompdf-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-1dE","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/4690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=4690"}],"version-history":[{"count":1,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/4690\/revisions"}],"predecessor-version":[{"id":4691,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/4690\/revisions\/4691"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/4692"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=4690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=4690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=4690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}