{"id":3184,"date":"2018-04-12T16:45:53","date_gmt":"2018-04-12T16:45:53","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=3184"},"modified":"2018-04-12T16:52:07","modified_gmt":"2018-04-12T16:52:07","slug":"convert-html-to-pdf-in-codeigniter-using-dompdf","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/","title":{"rendered":"Convert HTML to PDF in CodeIgniter using Dompdf"},"content":{"rendered":"<p>PDF is the most used format to create the document in the web application. PDF file provides a simple and user-friendly way to download the bunch of data in a file. Before download the web page content, the content needs to be converted from HTML to PDF. The HTML to PDF conversion can be easily done using PHP library.<\/p>\n<p>Dompdf is a PHP library that helps to generate PDF from HTML content. It&#8217;s very easy to <a href=\"https:\/\/www.codexworld.com\/convert-html-to-pdf-php-dompdf\/\">convert HTML to PDF in PHP with Dompdf<\/a>. If your application built with CodeIgniter, a PDF library needs to be created to generate PDF using Dompdf. In this tutorial, we will show you how to convert HTML to pdf and <b>generate PDF using Dompdf in CodeIgniter<\/b>.<\/p>\n<h2>Controller<\/h2>\n<p>The <code>index()<\/code> function of Welcome controller generates PDF from HTML.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Get output HTML from welcome_message view.<\/li>\n<li>Load CodeIgniter Pdf library to use Dompdf class.<\/li>\n<li>Convert HTML content and generate PDF using Dompdf.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php&nbsp;defined<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'BASEPATH'<\/span><span style=\"color: #007700\">)&nbsp;OR&nbsp;exit(<\/span><span style=\"color: #DD0000\">'No&nbsp;direct&nbsp;script&nbsp;access&nbsp;allowed'<\/span><span style=\"color: #007700\">);<br \/><br \/>class&nbsp;<\/span><span style=\"color: #0000BB\">Welcome&nbsp;<\/span><span style=\"color: #007700\">extends&nbsp;<\/span><span style=\"color: #0000BB\">CI_Controller&nbsp;<\/span><span style=\"color: #007700\">{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">index<\/span><span style=\"color: #007700\">(){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">load<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">view<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'welcome_message'<\/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;Get&nbsp;output&nbsp;html<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$html&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">output<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">get_output<\/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;pdf&nbsp;library<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">load<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">library<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'pdf'<\/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<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/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: #0000BB\">$html<\/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;(Optional)&nbsp;Setup&nbsp;the&nbsp;paper&nbsp;size&nbsp;and&nbsp;orientation<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/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\">);<br \/>&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<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/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\">$this<\/span><span style=\"color: #007700\">-&gt;<\/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\">0<\/span><span style=\"color: #007700\">));<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>}<\/span><\/pre>\n<h2>Library<\/h2>\n<p><b>CodeIgniter PDF library (Pdf.php):<\/b><br \/>\nThe CodeIgniter PDF library is a custom library that helps to convert HTML output to PDF using DOMPDF.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php&nbsp;defined<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'BASEPATH'<\/span><span style=\"color: #007700\">)&nbsp;OR&nbsp;exit(<\/span><span style=\"color: #DD0000\">'No&nbsp;direct&nbsp;script&nbsp;access&nbsp;allowed'<\/span><span style=\"color: #007700\">);<br \/><\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;*&nbsp;CodeIgniter&nbsp;PDF&nbsp;Library<br \/>&nbsp;*<br \/>&nbsp;*&nbsp;Generate&nbsp;PDF&nbsp;in&nbsp;CodeIgniter&nbsp;applications.<br \/>&nbsp;*<br \/>&nbsp;*&nbsp;@package&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CodeIgniter<br \/>&nbsp;*&nbsp;@subpackage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Libraries<br \/>&nbsp;*&nbsp;@category&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Libraries<br \/>&nbsp;*&nbsp;@author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CodexWorld<br \/>&nbsp;*&nbsp;@license&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;https:\/\/www.codexworld.com\/license\/<br \/>&nbsp;*&nbsp;@link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;https:\/\/www.codexworld.com<br \/>&nbsp;*\/<br \/><br \/>\/\/&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\">Pdf<br \/><\/span><span style=\"color: #007700\">{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">__construct<\/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;include&nbsp;autoloader<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">require_once&nbsp;<\/span><span style=\"color: #0000BB\">dirname<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">__FILE__<\/span><span style=\"color: #007700\">).<\/span><span style=\"color: #DD0000\">'\/dompdf\/autoload.inc.php'<\/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;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\">$pdf&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: #0000BB\">$CI&nbsp;<\/span><span style=\"color: #007700\">=&amp;&nbsp;<\/span><span style=\"color: #0000BB\">get_instance<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$CI<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">dompdf&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$pdf<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>}<br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span><\/pre>\n<p><b>Dompdf Library (\/dompdf):<\/b><br \/>\nThe custom PDF library uses Dompdf to generate PDF. So, include the Dompdf library to instantiate the Dompdf class.<\/p>\n<h2>Useful Methods of Dompdf<\/h2>\n<p>The following are some useful methods of Dompdf library to implement HTML to PDF conversion functionality.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>loadHtml(): Loads HTML content.\n<ul>\n<li>$str (string) \u2013 Required. Specify the HTML to load.<\/li>\n<li>$encoding (string) \u2013 Optional. Specify encoding.<\/li>\n<\/ul>\n<\/li>\n<li>loadHtmlFile(): Loads content from an HTML file.\n<ul>\n<li>$file (string) \u2013 Required. Specify file path to load.<\/li>\n<\/ul>\n<\/li>\n<li>output(): Returns the PDF as a string.\n<ul>\n<li>$options (array) \u2013 Optional. Specify whether content stream compression will enable. (compress => 1 or 0)<\/li>\n<\/ul>\n<\/li>\n<li>render(): Renders the HTML to PDF.<\/li>\n<li>setBasePath(): Sets the base path to include external stylesheets and images.\n<ul>\n<li>$basePath (string) \u2013 The base path to be used when loading the external resources URLs.<\/li>\n<\/ul>\n<\/li>\n<li>setPaper(): Sets the paper size &#038; orientation.\n<ul>\n<li>$size (string|array) \u2013 \u2018letter\u2019, \u2018legal\u2019, \u2018A4\u2019, etc.<\/li>\n<li>$orientation (string) \u2013 \u2018portrait\u2019 or \u2018landscape\u2019.<\/li>\n<\/ul>\n<\/li>\n<li>stream(): Streams the PDF to the client.\n<ul>\n<li>$filename (string) \u2013 Specify name of the file (without .pdf extension).<\/li>\n<li>$options (array) \u2013\n<ul>\n<li>&#8216;compress&#8217; => 1 or 0 \u2013 enable content stream compression.<\/li>\n<li>&#8216;Attachment&#8217; => 1 = download or 0 = preview<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Configuration Options<\/h2>\n<p>Dompdf library has various options to configure the PDF generation. In the example code, some most used configuration options (paper size and orientation, PDF output, etc.) are used. You can see all other available options from <a target=\"_blank\" href=\"https:\/\/github.com\/dompdf\/dompdf\/blob\/master\/src\/Options.php\">here<\/a>.<\/p>\n<h2>Conclusion<\/h2>\n<p>Our custom Dompdf library provides the easiest way to convert HTML to PDF in CodeIgniter using Dompdf. Our example code shows the most useful configuration options to generate PDF in CodeIgniter. All the available functionality of Dompdf class can be used in <b>CodeIgniter PDF library<\/b>. The example code generates the PDF from HTML of the view. You can convert any dynamic HTML and generate PDF as per your needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PDF is the most used format to create the document in the web application. PDF file provides a simple and user-friendly way to download the bunch of data in a file. Before download the web <\/p>\n","protected":false},"author":1,"featured_media":3186,"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":[8],"tags":[55,180,166,181],"class_list":["post-3184","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codeigniter","tag-codeigniter","tag-dompdf","tag-library","tag-pdf","cat-8-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 CodeIgniter using Dompdf - CodexWorld<\/title>\n<meta name=\"description\" content=\"CodeIgniter HTML to PDF library - Create custom PDF library to generate PDF in CodeIgniter using Dompdf. Learn how to convert HTML to PDF in CodeIgniter using Dompdf. CodeIgniter Dompdf library to convert HTML to PDF.\" \/>\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-codeigniter-using-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 CodeIgniter using Dompdf - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"CodeIgniter HTML to PDF library - Create custom PDF library to generate PDF in CodeIgniter using Dompdf. Learn how to convert HTML to PDF in CodeIgniter using Dompdf. CodeIgniter Dompdf library to convert HTML to PDF.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-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=\"2018-04-12T16:45:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-04-12T16:52:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/04\/convert-generate-html-to-pdf-in-codeigniter-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=\"5 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-codeigniter-using-dompdf\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Convert HTML to PDF in CodeIgniter using Dompdf\",\"datePublished\":\"2018-04-12T16:45:53+00:00\",\"dateModified\":\"2018-04-12T16:52:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/\"},\"wordCount\":468,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png\",\"keywords\":[\"CodeIgniter\",\"Dompdf\",\"Library\",\"PDF\"],\"articleSection\":[\"CodeIgniter\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/\",\"name\":\"Convert HTML to PDF in CodeIgniter using Dompdf - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png\",\"datePublished\":\"2018-04-12T16:45:53+00:00\",\"dateModified\":\"2018-04-12T16:52:07+00:00\",\"description\":\"CodeIgniter HTML to PDF library - Create custom PDF library to generate PDF in CodeIgniter using Dompdf. Learn how to convert HTML to PDF in CodeIgniter using Dompdf. CodeIgniter Dompdf library to convert HTML to PDF.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/convert-html-to-pdf-in-codeigniter-using-dompdf\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Convert HTML to PDF in CodeIgniter using 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 CodeIgniter using Dompdf - CodexWorld","description":"CodeIgniter HTML to PDF library - Create custom PDF library to generate PDF in CodeIgniter using Dompdf. Learn how to convert HTML to PDF in CodeIgniter using Dompdf. CodeIgniter Dompdf library to convert HTML to PDF.","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-codeigniter-using-dompdf\/","og_locale":"en_US","og_type":"article","og_title":"Convert HTML to PDF in CodeIgniter using Dompdf - CodexWorld","og_description":"CodeIgniter HTML to PDF library - Create custom PDF library to generate PDF in CodeIgniter using Dompdf. Learn how to convert HTML to PDF in CodeIgniter using Dompdf. CodeIgniter Dompdf library to convert HTML to PDF.","og_url":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2018-04-12T16:45:53+00:00","article_modified_time":"2018-04-12T16:52:07+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/04\/convert-generate-html-to-pdf-in-codeigniter-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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Convert HTML to PDF in CodeIgniter using Dompdf","datePublished":"2018-04-12T16:45:53+00:00","dateModified":"2018-04-12T16:52:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/"},"wordCount":468,"commentCount":5,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/04\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png","keywords":["CodeIgniter","Dompdf","Library","PDF"],"articleSection":["CodeIgniter"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/","url":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/","name":"Convert HTML to PDF in CodeIgniter using Dompdf - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/04\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png","datePublished":"2018-04-12T16:45:53+00:00","dateModified":"2018-04-12T16:52:07+00:00","description":"CodeIgniter HTML to PDF library - Create custom PDF library to generate PDF in CodeIgniter using Dompdf. Learn how to convert HTML to PDF in CodeIgniter using Dompdf. CodeIgniter Dompdf library to convert HTML to PDF.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/04\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/04\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png","width":1366,"height":768,"caption":"convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/convert-html-to-pdf-in-codeigniter-using-dompdf\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Convert HTML to PDF in CodeIgniter using 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\/2018\/04\/convert-generate-html-to-pdf-in-codeigniter-dompdf-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-Pm","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3184","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=3184"}],"version-history":[{"count":1,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3184\/revisions"}],"predecessor-version":[{"id":3185,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3184\/revisions\/3185"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/3186"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=3184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=3184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=3184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}