{"id":9479,"date":"2020-05-27T04:05:15","date_gmt":"2020-05-27T04:05:15","guid":{"rendered":"https:\/\/www.milesweb.in\/hosting-faqs\/?p=9479"},"modified":"2020-05-27T04:05:15","modified_gmt":"2020-05-27T04:05:15","slug":"generate-pdf-files-with-php","status":"publish","type":"post","link":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/","title":{"rendered":"Learn to Generate PDF Files with PHP"},"content":{"rendered":"<p>FPDF, a PHP class, enables you to generate PDF files, and doesn\u2019t depend on additional PHP libraries.<\/p>\n<p>Available for free, it can be downloaded from its official website\u2019s download section. Its download package comprises of all the essential files as well as some tutorials on using it.<\/p>\n<p>The package can be uploaded on your MilesWeb account using FTP, or using File Manager in cPanel and extracted it after that. Then place the extracted contents in any folder on your account, which will then get converted into the FPDF installation folder.<\/p>\n<p>The basic example of using FPDF is by using the below PHP code (you should select the FPDF package in the folder where the PHP file with the code is placed):<\/p>\n<pre class=\"lang:default decode:true \">&lt;?php\r\nrequire(\u2018.\/fpdf.php\u2019);\r\n\r\n$pdf=new FPDF();\r\n$pdf-&gt;AddPage();\r\n$pdf-&gt;SetFont('Arial','B',16);\r\n$pdf-&gt;Cell(40,10,'Hello World!');\r\n$pdf-&gt;Output();\r\n?&gt;<\/pre>\n<p>Suppose you have downloaded and extracted the FPDF package within a folder called ~\/public_html\/fpdf\/.<\/p>\n<p>Additionally, you can create a new PHP file called toPDF.php within the same folder and insert the above code. Then save the file and try accessing it through your browser:<\/p>\n<p>http:\/\/yourdomain.com\/fpdf\/toPDF.php<\/p>\n<p>After the execution, the PHP script will generate a PDF file in your browser.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FPDF, a PHP class, enables you to generate PDF files, and doesn\u2019t depend on additional PHP libraries. Available for free, it can be downloaded from its official website\u2019s download section. Its download package comprises of all the essential files as well as some tutorials on using it. The package can be uploaded on your MilesWeb [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[1463,1462,1461,18],"class_list":["post-9479","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos","tag-fpdf","tag-generate-pdf-files","tag-pdf-files","tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Learn to Generate PDF Files with PHP<\/title>\n<meta name=\"description\" content=\"You can generate PDF files with PHP class called FPDF easily.\" \/>\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.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn to Generate PDF Files with PHP\" \/>\n<meta property=\"og:description\" content=\"You can generate PDF files with PHP class called FPDF easily.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-27T04:05:15+00:00\" \/>\n<meta name=\"author\" content=\"Pallavi Godse\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pallavi Godse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/\"},\"author\":{\"name\":\"Pallavi Godse\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\"},\"headline\":\"Learn to Generate PDF Files with PHP\",\"datePublished\":\"2020-05-27T04:05:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/\"},\"wordCount\":197,\"commentCount\":0,\"keywords\":[\"FPDF\",\"generate PDF files\",\"PDF files\",\"PHP\"],\"articleSection\":[\"How-Tos\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/\",\"name\":\"Learn to Generate PDF Files with PHP\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\"},\"datePublished\":\"2020-05-27T04:05:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\"},\"description\":\"You can generate PDF files with PHP class called FPDF easily.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learn to Generate PDF Files with PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\",\"name\":\"Pallavi Godse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3602d0ac1ab89332aea8205dcf474af4ff4eb319cfd584544038908cd5e4c966?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3602d0ac1ab89332aea8205dcf474af4ff4eb319cfd584544038908cd5e4c966?s=96&d=blank&r=g\",\"caption\":\"Pallavi Godse\"},\"description\":\"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.\",\"sameAs\":[\"https:\/\/www.milesweb.in\"],\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/author\/pallavi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Learn to Generate PDF Files with PHP","description":"You can generate PDF files with PHP class called FPDF easily.","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.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/","og_locale":"en_US","og_type":"article","og_title":"Learn to Generate PDF Files with PHP","og_description":"You can generate PDF files with PHP class called FPDF easily.","og_url":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2020-05-27T04:05:15+00:00","author":"Pallavi Godse","twitter_misc":{"Written by":"Pallavi Godse","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/#article","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/"},"author":{"name":"Pallavi Godse","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945"},"headline":"Learn to Generate PDF Files with PHP","datePublished":"2020-05-27T04:05:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/"},"wordCount":197,"commentCount":0,"keywords":["FPDF","generate PDF files","PDF files","PHP"],"articleSection":["How-Tos"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/","name":"Learn to Generate PDF Files with PHP","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website"},"datePublished":"2020-05-27T04:05:15+00:00","author":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945"},"description":"You can generate PDF files with PHP class called FPDF easily.","breadcrumb":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/generate-pdf-files-with-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.in\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"Learn to Generate PDF Files with PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.in\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945","name":"Pallavi Godse","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3602d0ac1ab89332aea8205dcf474af4ff4eb319cfd584544038908cd5e4c966?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3602d0ac1ab89332aea8205dcf474af4ff4eb319cfd584544038908cd5e4c966?s=96&d=blank&r=g","caption":"Pallavi Godse"},"description":"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.","sameAs":["https:\/\/www.milesweb.in"],"url":"https:\/\/www.milesweb.in\/hosting-faqs\/author\/pallavi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/9479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=9479"}],"version-history":[{"count":1,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/9479\/revisions"}],"predecessor-version":[{"id":9481,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/9479\/revisions\/9481"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=9479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=9479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=9479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}