{"id":816,"date":"2024-07-22T08:08:09","date_gmt":"2024-07-22T08:08:09","guid":{"rendered":"https:\/\/blog.200oksolutions.com\/?p=816"},"modified":"2025-12-04T07:44:08","modified_gmt":"2025-12-04T07:44:08","slug":"generate-mpdf-in-php-without-using-composer","status":"publish","type":"post","link":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/","title":{"rendered":"Generate mPdf in PHP Without Using Composer"},"content":{"rendered":"\n<p>If you want to use mPDF without Composer&#8217;s intervention inside your<br>CodeIgniter project, then here are the steps to follow to download mPDF<br>manually and use it in a CodeIgniter application.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls src=\"https:\/\/blog.200oksolutions.com\/wp-content\/uploads\/2024\/07\/Easy-Guide-to-Generating-mPDF-in-PHP-Without-Composer_-Quick-Tutorial-landscape.mp4\"><\/video><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Download mPDF<\/h2>\n\n\n\n<p>To get the latest version of mPDF without using Composer, you can manually download it<br>from the mPDF GitHub repository. Here are the steps to do so:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Visit the mPDF GitHub repository.<\/li>\n\n\n\n<li>GitHub &#8211; mpdf\/mpdf: PHP library generating PDF files from UTF-8 encoded HTML<\/li>\n\n\n\n<li>Click on the &#8220;Code&#8221; button and select &#8220;Download ZIP&#8221;.<\/li>\n\n\n\n<li>Unzip the downloaded file to your desired directory.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Include mPDF in Your Project<\/h2>\n\n\n\n<p>Move the mpdf directory to your project directory where you want to use mPDF.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"797\" height=\"565\" src=\"https:\/\/blog.200oksolutions.com\/wp-content\/uploads\/2024\/07\/Screenshot-2024-07-22-124158.webp\" alt=\"guide to mpdf directory\" class=\"wp-image-820\" srcset=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Screenshot-2024-07-22-124158.webp 797w, https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Screenshot-2024-07-22-124158-300x213.webp 300w, https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Screenshot-2024-07-22-124158-768x544.webp 768w\" sizes=\"(max-width: 797px) 100vw, 797px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Autoload Dependencies<\/h2>\n\n\n\n<p>mPDF requires some dependencies which are managed by Composer, but since<br>you&#8217;re not using Composer, you need to manually include the autoload file.<br><\/p>\n\n\n\n<p>In your project, create an autoload.php file and include the necessary dependencies<br>like this:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Using mPDF in CodeIgniter<\/h2>\n\n\n\n<p>You can now start using mPDF in your project. Here&#8217;s a simple example of how to<br>use mPDF to generate a PDF in a CodeIgniter controller:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\ndefined('BASEPATH') OR exit('No direct script access allowed');\n \/\/ Include the mPDF autoload file\nrequire_once APPPATH . 'third_party\/autoload.php';\nclass PdfController extends CI_Controller {\n public function index()\n {\n $pdf = new \\Mpdf\\Mpdf();\n\/\/ Set the header\n$pdf->SetHeader('header');\n\/\/ Write HTML content to the PDF\n$pdf->WriteHTML('Hello World');\n\/\/ Set the footer\n$pdf->SetFooter('footer');\n\/\/ Clear output buffer\nob_end_clean();\n\/\/ Output the PDF\n$pdf->Output('genpdf_view.pdf', 'D');\n }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Output: &#8211;<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"467\" height=\"281\" src=\"https:\/\/blog.200oksolutions.com\/wp-content\/uploads\/2024\/07\/Screenshot-2024-07-22-124733.webp\" alt=\"output of tmpdf in php\" class=\"wp-image-821\" srcset=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Screenshot-2024-07-22-124733.webp 467w, https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Screenshot-2024-07-22-124733-300x181.webp 300w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Advantages of Using mPDF Without Composer in CodeIgniter :-<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>.No Dependency on Composer.<\/li>\n\n\n\n<li>Greater Control Over Dependencies.<\/li>\n\n\n\n<li>Reduced Disk Space and Resource Usage.<\/li>\n\n\n\n<li>Enhanced Security.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion: &#8211;<\/h2>\n\n\n\n<p>By following these steps, you should be able to use the latest version of mPDF<br>in your CodeIgniter project without using Composer.<br><\/p>\n\n\n\n<p>If you encounter any issues with dependencies, you might need to manually<br>download and include those as well. This approach ensures you have full<br>control over your mPDF integration and can easily customize it to fit your<br>project&#8217;s needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to use mPDF without Composer&#8217;s intervention inside yourCodeIgniter project, then here are the steps&hellip;<\/p>\n","protected":false},"author":5,"featured_media":819,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[154,155,156,30,157],"class_list":["post-816","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-generate-mpdf-in-php-without-using-composer","tag-guide-to-generate-mpdf-in-php-without-using-composer","tag-mpdf-in-php","tag-php-development","tag-without-using-composer"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Generate mPdf in PHP Without Using Composer Web Development, Software, and App Blog | 200OK Solutions<\/title>\n<meta name=\"description\" content=\"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.\" \/>\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.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Generate mPdf in PHP Without Using Composer Web Development, Software, and App Blog | 200OK Solutions\" \/>\n<meta property=\"og:description\" content=\"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Development, Software, and App Blog | 200OK Solutions\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-22T08:08:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-04T07:44:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Generate-mPdf-in-PHP-Without-Using-Composer.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"2048\" \/>\n\t<meta property=\"og:image:height\" content=\"1373\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Piyush Solanki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Piyush Solanki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Generate mPdf in PHP Without Using Composer Web Development, Software, and App Blog | 200OK Solutions","description":"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.","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.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/","og_locale":"en_US","og_type":"article","og_title":"Generate mPdf in PHP Without Using Composer Web Development, Software, and App Blog | 200OK Solutions","og_description":"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.","og_url":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/","og_site_name":"Web Development, Software, and App Blog | 200OK Solutions","article_published_time":"2024-07-22T08:08:09+00:00","article_modified_time":"2025-12-04T07:44:08+00:00","og_image":[{"width":2048,"height":1373,"url":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Generate-mPdf-in-PHP-Without-Using-Composer.webp","type":"image\/webp"}],"author":"Piyush Solanki","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Piyush Solanki","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/#article","isPartOf":{"@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/"},"author":{"name":"Piyush Solanki","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e"},"headline":"Generate mPdf in PHP Without Using Composer","datePublished":"2024-07-22T08:08:09+00:00","dateModified":"2025-12-04T07:44:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/"},"wordCount":279,"commentCount":0,"publisher":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/#primaryimage"},"thumbnailUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Generate-mPdf-in-PHP-Without-Using-Composer.webp","keywords":["Generate mPdf in PHP Without Using Composer","Guide to Generate mPdf in PHP Without Using Composer","mPdf in PHP","PHP Development","Without Using Composer"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/","url":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/","name":"Generate mPdf in PHP Without Using Composer Web Development, Software, and App Blog | 200OK Solutions","isPartOf":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/#primaryimage"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/#primaryimage"},"thumbnailUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Generate-mPdf-in-PHP-Without-Using-Composer.webp","datePublished":"2024-07-22T08:08:09+00:00","dateModified":"2025-12-04T07:44:08+00:00","description":"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.","breadcrumb":{"@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/#primaryimage","url":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Generate-mPdf-in-PHP-Without-Using-Composer.webp","contentUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2024\/07\/Generate-mPdf-in-PHP-Without-Using-Composer.webp","width":2048,"height":1373,"caption":"Guide to create mpdf in PHP"},{"@type":"BreadcrumbList","@id":"https:\/\/www.200oksolutions.com\/blog\/generate-mpdf-in-php-without-using-composer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.200oksolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Generate mPdf in PHP Without Using Composer"}]},{"@type":"WebSite","@id":"https:\/\/www.200oksolutions.com\/blog\/#website","url":"https:\/\/www.200oksolutions.com\/blog\/","name":"Web Development, Software, and App Blog | 200OK Solutions","description":"","publisher":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.200oksolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.200oksolutions.com\/blog\/#organization","name":"Web Development Blog | Software Blog | App Blog","url":"https:\/\/www.200oksolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png","contentUrl":"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png","width":500,"height":191,"caption":"Web Development Blog | Software Blog | App Blog"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.instagram.com\/200ok_solutions\/"]},{"@type":"Person","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e","name":"Piyush Solanki","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/962a2b0b4db856e6851ec7d838597a0395adcaae9c0091d223de9942a4254461?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/962a2b0b4db856e6851ec7d838597a0395adcaae9c0091d223de9942a4254461?s=96&d=mm&r=g","caption":"Piyush Solanki"},"description":"Piyush is a seasoned PHP Tech Lead with 10+ years of experience architecting and delivering scalable web and mobile backend solutions for global brands and fast-growing SMEs. He specializes in PHP, MySQL, CodeIgniter, WordPress, and custom API development, helping businesses modernize legacy systems and launch secure, high-performance digital products. He collaborates closely with mobile teams building Android &amp; iOS apps , developing RESTful APIs, cloud integrations, and secure payment systems using platforms like Stripe, AWS S3, and OTP\/SMS gateways. His work extends across CMS customization, microservices-ready backend architectures, and smooth product deployments across Linux and cloud-based environments. Piyush also has a strong understanding of modern front-end technologies such as React and TypeScript, enabling him to contribute to full-stack development workflows and advanced admin panels. With a successful delivery track record in the UK market and experience building digital products for sectors like finance, hospitality, retail, consulting, and food services, Piyush is passionate about helping SMEs scale technology teams, improve operational efficiency, and accelerate innovation through backend excellence and digital tools.","url":"https:\/\/www.200oksolutions.com\/blog\/author\/piyush\/"}]}},"_links":{"self":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=816"}],"version-history":[{"count":1,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/816\/revisions"}],"predecessor-version":[{"id":826,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/816\/revisions\/826"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/media\/819"}],"wp:attachment":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}