{"id":4326,"date":"2020-06-25T14:01:00","date_gmt":"2020-06-25T14:01:00","guid":{"rendered":"https:\/\/uhp.digital\/?p=4326"},"modified":"2020-12-09T12:16:56","modified_gmt":"2020-12-09T12:16:56","slug":"word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren","status":"publish","type":"post","link":"https:\/\/uhp.digital\/en\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/","title":{"rendered":"How to edit word document templates with PHP and convert it to PDF?"},"content":{"rendered":"<p>Creating custom PDF documents is a very time-consuming task in projects. In order to improve this process there are various approaches - one of the most common ones by creating a HTML document that gets converted to PDF. At the end of the day this solution is not always the best as every new PDF needs to be implemented as a HTML document again before you can start.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Intro<\/strong><\/h3>\n\n\n\n<p>You can find few solutions for editing word document templates with PHP on the Internet, the most popular ones being: PHP Word, phpdocx and LiveDocx. Since PHP Word is the only one that is free, I gave it a go.<\/p>\n\n\n\n<p>PHP Word authors say about PHP Word: \u201cPHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft <a href=\"http:\/\/en.wikipedia.org\/wiki\/Office_Open_XML\">Office Open XML<\/a> (OOXML or OpenXML), OASIS <a href=\"http:\/\/en.wikipedia.org\/wiki\/OpenDocument\">Open Document Format for Office Applications<\/a> (OpenDocument or ODF), <a href=\"http:\/\/en.wikipedia.org\/wiki\/Rich_Text_Format\">Rich Text Format<\/a> (RTF), HTML, and PDF\u201d.<\/p>\n\n\n\n<p>The tested version is v0.12.1. Its supported formats are, better known by their extensions, Office Open XML - .docx and .docm, Open Document - .odt and .fodt.<\/p>\n\n\n\n<p>Even though the PHP Word can be found on both&nbsp;&nbsp;<a href=\"https:\/\/phpword.codeplex.com\/\">CodePlex<\/a> and <a href=\"https:\/\/github.com\/PHPOffice\/PHPWord\">GitHub<\/a> , it has moved to GitHub some time ago. GitHub is also used for posting bug issues. Documentation is on  Read the Docs.<\/p>\n\n\n\n<p>Also, in case someone needs a free solution for manipulating spreadsheets, the same team, the PHP Office has a PHP Excel library.\nI will now explain to you how to set up and use PHP Word for editing .docx templates.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"750\" height=\"400\" src=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/5a4efc5b_upload.png\" alt=\"\" class=\"wp-image-4345\" srcset=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/5a4efc5b_upload.png 750w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/5a4efc5b_upload-300x160.png 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><figcaption>doc to pdf<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>PHP Word Setup<\/strong><\/h3>\n\n\n\n<p>This part explains how to set up PHP Word. I hereby start with a list of prerequisites and will then explain how to install PHP Word on a Linux Server, and finally, how to use it.<\/p>\n\n\n\n<p><strong>Requirements<\/strong><\/p>\n\n\n\n<p>Before we start with different steps, we need to consider which prerequisites are necessary. First you need to be able to set the PHP Word on your Linux web server. Therefore you need:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>PHP 5.3+<\/li><li><a href=\"http:\/\/php.net\/manual\/en\/xml.installation.php\">PHP XML Parser extension<\/a> (it is enabled by default)<\/li><li><a href=\"https:\/\/getcomposer.org\/download\/\">Composer<\/a> (optional, but recommended)<\/li><li><a href=\"http:\/\/php.net\/manual\/en\/phar.installation.php\">PHP Phar extension<\/a><ul><li>comes pre-installed with required version of PHP<\/li><li>to enable the Phar extension, uncomment or add following line if it is not present in php.ini file:<\/li><\/ul><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/www.openssl.org\/source\/\">OpenSSL package<\/a><\/li><li><a href=\"http:\/\/php.net\/manual\/en\/openssl.installation.php\">PHP Openssl extension<\/a> (comes pre-installed with PHP)<ul><li>comes with OpenSSL package<\/li><li>to enable OpenSSL extension, uncomment or add following line if it is not present in php.ini file:<\/li><\/ul><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Installation<\/strong><\/h3>\n\n\n\n<p>The recommended way to install PHP Word is to use a composer, but if you prefer not to use the composer, even though you know you should use it, you can download or clone project from <a href=\"https:\/\/github.com\/PHPOffice\/PHPWord\/tree\/master\">GitHub<\/a> .<\/p>\n\n\n\n<p>\u201cComposer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install\/update) them for you.\u201d \u201cIt deals with 'packages' or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default it does not install anything globally\u00b2. Composer is using composer.json file to know which packages or libraries it needs to download.<\/p>\n\n\n\n<p>To install PHP Word using composer way, you need to add <em>&#8222;phpoffice\/phpword&#8220; <\/em>: <em>&#8222;dev-master&#8220;<\/em> to your <em>composer.json<\/em> file under the <em>require<\/em> key. If you don't have <em>composer.json<\/em> file, simply create one in your project root with following content:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{<br><em>   \"require\": {<\/em><br>    <em>\"phpoffice\/phpword\": \"dev-master\"<\/em><br>    <em>}<\/em><br>}<br><\/pre>\n\n\n\n<p>In both cases, after the <em>composer.json<\/em> file is saved, issue the <em>composer install<\/em> command in <em>terminal<\/em> in the directory where you placed it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Including PHP Word to your specific project<\/strong><\/h3>\n\n\n\n<p>To include PHP Word to your project, you need to require the PHP Word <em>Autoloader.php<\/em> from <em>src\/PHPWord<\/em> folder and register it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">require_once 'src\/PhpWord\/Autoloader.php';\n\\PhpOffice\\PhpWord\\Autoloader::register(); <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Editing templates<\/strong><\/h3>\n\n\n\n<p>You probably found yourself in a situation where you need some template documents with only a few different values for each user, receipt or something else. That is exactly the situation where PHP Word would come very handy and make your work effortless.<\/p>\n\n\n\n<p>Thereby it is the only requirement to save the document <em>.docx<\/em> extension.\nPlaceholders for variables or arrays in the template are defined the same way, <em>${variableName}<\/em> or <em>${arrayName}<\/em>. Placeholder for array MUST be in a table cell, so it can be cloned later. This is good, because it enables you to later insert as many entries to one placeholder programmatically.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"345\" src=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498627-1024x345.png\" alt=\"\" class=\"wp-image-4327\" srcset=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498627-1024x345.png 1024w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498627-300x101.png 300w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498627-768x259.png 768w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498627.png 1325w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>To replace the placeholders with your variables, you need to:<\/p>\n\n\n\n<p>Open template:<br> $template = new\\PhpOffice\\PhpWord\\TemplateProcessor(&#8218;folder\/file.docx&#8216;);<\/p>\n\n\n\n<p>Replace your placeholders with your variables:<br>$template-&gt;setValue(&#8218;variableName&#8216;, &#8218;MyVariableValue&#8216;); <\/p>\n\n\n\n<p>Replace your placeholders with your arrays: <br>3a: first you need to clone your array placeholder to the count of your array<br>3b: $template-&gt;cloneRow(&#8218;arrayName&#8216;, count($array));<br>3c: and then you need to give all of them a values<br>3d: for($number = 0; $number &lt; count($array); $number++) {<br>&nbsp;&nbsp;&nbsp;&nbsp;$template-&gt;setValue(&#8218;arrayName#&#8216;.($number+1), htmlspecialchars($array[$number], ENT_COMPAT, &#8218;UTF-8&#8216;));<br>}<\/p>\n\n\n\n<p>And save the modified file <br>$template-&gt;saveAs(&#8218;folder\/result.docx&#8216;);<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"857\" height=\"410\" src=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498945.png\" alt=\"\" class=\"wp-image-4330\" srcset=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498945.png 857w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498945-300x144.png 300w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498945-768x367.png 768w\" sizes=\"(max-width: 857px) 100vw, 857px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Converting to PDF<\/strong><\/h3>\n\n\n\n<p>There is an option to integrate <a href=\"https:\/\/github.com\/dompdf\/dompdf\">dompdf<\/a> with PHP Word to convert file to PDF after editing template, but it won't give expected result of a well-formated document. If you want to achieve the best results, the easiest thing to do is to install LibreOffice on your server. If you are on shared hosting, you probably won't be able to do that, so you'll need either Virtual Private Server (VPS) or dedicated hosting. VPS hosting is not that expensive these days and if you need converting files to PDF, you will have to get it and set it up. If you bump into problems when trying to convert with LibreOffice, you still have great backup \u2013 unoconv.<\/p>\n\n\n\n<p>Universal Office Converter (unoconv) is a command line tool to convert any document format that LibreOffice can import to any document format that LibreOffice can export. It makes use of the LibreOffice\u2019s UNO bindings for non-interactive conversion of documents.<\/p>\n\n\n\n<p>After you have installed LibreOffice on your server, you can see if it works by doing the following: Navigate to folder where you have some of your document files and issue following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">libreoffice --headless --convert-to pdf \/path\/to\/document\/file --outdir \/desired\/output\/directory<\/pre>\n\n\n\n<p>or if you want to issue it from PHP:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">shell_exec('libreoffice --headless --convert-to pdf \/path\/to\/document\/file --outdir \/desired\/output\/directory');<\/pre>\n\n\n\n<p>If you get PDF after issuing that command, you are good to go and everything works. However, there are two possible problems I have already warned you about.<\/p>\n\n\n\n<p>The first problem is:<\/p>\n\n\n\n<p><em>\u201c[Java framework] Error in function createSettingsDocument (elements.cxx).javaldx failed!<\/em><\/p>\n\n\n\n<p><em>Warning: failed to read path from javaldx\u201d<\/em><\/p>\n\n\n\n<p>This one can be solved. You need to create folder <em>.config <\/em>in home folder of your apache user. For CentOS, Debian and Ubuntu this is \/var\/www. You will neeed to use user with sudo rights (or root user, not recommended) to issue required commands. Navigate to required folder:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/var\/www<\/pre>\n\n\n\n<p>and create folder:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir .config&nbsp;&nbsp;&nbsp;&nbsp;<\/pre>\n\n\n\n<p>After that, you need to make apache user and group owner of that newly created folder. Apache user and group are apache for CentOS and www-data for Ubuntu and Debian. For CentOS<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo chown -R apache:apache \/var\/www\/.config<\/pre>\n\n\n\n<p>or for Debian\/Ubuntu:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo chown -R www-data:www-data \/var\/www\/.config<\/pre>\n\n\n\n<p><br>The second problem starts with:<\/p>\n\n\n\n<p><em>\u201cError: Please verify input parameters&#8230;\u201d<\/em><\/p>\n\n\n\n<p>For this problem, I didn't find any working solutions, even though there are some proposed online. If you have time, check them, but I wouldn't hope too much. Should you be able to find a solution, please let me know in the comments on this article.<\/p>\n\n\n\n<p>If you had no luck with LibreOffice, you can still use unoconv for same result, with few more tunings.<\/p>\n\n\n\n<p>After you install it, you will need to grant sudo rights to apache user and group for unoconv (only for unoconv!) since it requires sudo rights to be ran. Again, you will need to run following command with user with sudo rights:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo visudo<\/pre>\n\n\n\n<p>When it opens, scroll down to the bottom and find a line which looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root ALL=(ALL:ALL) ALL<\/pre>\n\n\n\n<p>You should add following below that line for CentOS:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apache ALL=NOPASSWD:\/usr\/bin\/unoconv<br> %apache ALL=NOPASSWD:\/usr\/bin\/unoconv<\/pre>\n\n\n\n<p>or for Debian\/Ubuntu:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">www-data ALL=NOPASSWD:\/usr\/bin\/unoconv<br>%www-data ALL=NOPASSWD:\/usr\/bin\/unoconv<\/pre>\n\n\n\n<p>This enables your apache user and group to run only unoconv with sudo rights with no password required.<\/p>\n\n\n\n<p>With that done, you set unoconv. You can try it by issuing command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo unoconv -f pdf \/path\/to\/input\/file<\/pre>\n\n\n\n<p>This command will convert the input file to PDF and save it to the current folder. Or if you want to use it from PHP, just run it with shell_exec:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">shell_exec('sudo unoconv -f pdf \/path\/to\/input\/file');<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Results<\/strong><\/h3>\n\n\n\n<p>As a result of this whole process, we get a pixel-perfect pdf document that we can send to clients.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"503\" src=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498970-1024x503.png\" alt=\"\" class=\"wp-image-4332\" srcset=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498970-1024x503.png 1024w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498970-300x147.png 300w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498970-768x377.png 768w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498970-1536x754.png 1536w, https:\/\/uhp.digital\/wp-content\/uploads\/2020\/07\/1586336498970.png 1700w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The biggest advantage of this solution is that it saves hours of development. Everyone who was making any kind of PDFs, using any solution \u2013 either solution that write (or draw) directly to pdf or made HTML template first and then converted it to pdf will know how much time it consumes and that results are not always what we expect. Not to mention that if you already spent time creating PDF and then client wants some changes. It was a nightmare. With this solution, you can let clients create their own template and change it any time without giving you a headache.<\/p>\n\n\n\n<p>Earlier we also wasted so much time on aligning PDFs, but now we established this as a team-wide service which all our future projects can rely on and we can use our saved time to do something smarter \u2013 anything is better than wasting hours on creating PDFs :)<\/p>\n\n\n\n<p>I hope this tutorial helps you to improve your development of PDFs in PHP. If you have any questions, feel free to contact us and leave us a message.<\/p>\n\n\n\n<p>Furthermore, if there are things you consider to be important for this tutorial, please feel free to let us know.<\/p>\n\n\n\n<p>&#8212;<\/p>\n\n\n\n<p><sup>1<\/sup> https:\/\/github.com\/PHPOffice\/PHPWord<\/p>\n\n\n\n<p><sup>2<\/sup> https:\/\/getcomposer.org\/doc\/00-intro.md3 <\/p>\n\n\n\n<p><sup>3<\/sup> https:\/\/github.com\/dagwieers\/unoconv<\/p>","protected":false},"excerpt":{"rendered":"<p>Would it not be great if you can just use the normal Word-documents to convert them to PDF by using PHP? Yes, it would - and this article explains you how to achieve that as we set up a service that converts word documents delivered by clients or other project stakeholders to PDF documents with PHP.<\/p>","protected":false},"author":1,"featured_media":4217,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"template-parts\/single-post-template.php","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[13],"tags":[],"class_list":["post-4326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Wie man Word-Dokumentvorlagen mit PHP bearbeitet und in PDF konvertiert - UHP<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/uhp.digital\/en\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wie man Word-Dokumentvorlagen mit PHP bearbeitet und in PDF konvertiert - UHP\" \/>\n<meta property=\"og:description\" content=\"W\u00e4re es nicht gro\u00dfartig, wenn Sie die normalen Word-Dokumente einfach mit PHP in PDF umwandeln k\u00f6nnten? Dieser Artikel erkl\u00e4rt Ihnen, wie Sie das umsetzen k\u00f6nnen. Wir haben einen Dienst eingerichtet, der Word-Dokumente, die von Kunden oder anderen Projektbeteiligten gelieferte werden, mit PHP in PDF-Dokumente konvertiert.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/uhp.digital\/en\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/\" \/>\n<meta property=\"og:site_name\" content=\"UHP\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/uhpdigital\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-25T14:01:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-09T12:16:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/02\/FB-Logo@3x.png\" \/>\n\t<meta property=\"og:image:width\" content=\"540\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"UHP\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"UHP\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/\"},\"author\":{\"name\":\"UHP\",\"@id\":\"https:\/\/uhp.digital\/#\/schema\/person\/82c263f7a03b60653db3cdd2d4301acb\"},\"headline\":\"Wie man Word-Dokumentvorlagen mit PHP bearbeitet und in PDF konvertiert\",\"datePublished\":\"2020-06-25T14:01:00+00:00\",\"dateModified\":\"2020-12-09T12:16:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/\"},\"wordCount\":1641,\"publisher\":{\"@id\":\"https:\/\/uhp.digital\/#organization\"},\"image\":{\"@id\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/06\/undraw-new-entries-nh-3-h.svg\",\"articleSection\":[\"Tech\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/\",\"url\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/\",\"name\":\"Wie man Word-Dokumentvorlagen mit PHP bearbeitet und in PDF konvertiert - UHP\",\"isPartOf\":{\"@id\":\"https:\/\/uhp.digital\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/06\/undraw-new-entries-nh-3-h.svg\",\"datePublished\":\"2020-06-25T14:01:00+00:00\",\"dateModified\":\"2020-12-09T12:16:56+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#primaryimage\",\"url\":\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/06\/undraw-new-entries-nh-3-h.svg\",\"contentUrl\":\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/06\/undraw-new-entries-nh-3-h.svg\",\"width\":477,\"height\":362},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/uhp.digital\/#website\",\"url\":\"https:\/\/uhp.digital\/\",\"name\":\"UHP\",\"description\":\"Delivering digital impact.\",\"publisher\":{\"@id\":\"https:\/\/uhp.digital\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/uhp.digital\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/uhp.digital\/#organization\",\"name\":\"UHP\",\"url\":\"https:\/\/uhp.digital\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/uhp.digital\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/01\/uhp-logo.svg\",\"contentUrl\":\"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/01\/uhp-logo.svg\",\"width\":88,\"height\":40,\"caption\":\"UHP\"},\"image\":{\"@id\":\"https:\/\/uhp.digital\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/uhpdigital\/\",\"https:\/\/www.instagram.com\/uhpdigital\/\",\"https:\/\/www.linkedin.com\/company\/uhp-software\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/uhp.digital\/#\/schema\/person\/82c263f7a03b60653db3cdd2d4301acb\",\"name\":\"UHP\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/uhp.digital\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c1bc770aea92efb4d58edb8d8e86f9eaa06def97a45852ce534799e57534d6c6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c1bc770aea92efb4d58edb8d8e86f9eaa06def97a45852ce534799e57534d6c6?s=96&d=mm&r=g\",\"caption\":\"UHP\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to edit word document templates with PHP and convert it to PDF? - UHP","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:\/\/uhp.digital\/en\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/","og_locale":"en_US","og_type":"article","og_title":"Wie man Word-Dokumentvorlagen mit PHP bearbeitet und in PDF konvertiert - UHP","og_description":"W\u00e4re es nicht gro\u00dfartig, wenn Sie die normalen Word-Dokumente einfach mit PHP in PDF umwandeln k\u00f6nnten? Dieser Artikel erkl\u00e4rt Ihnen, wie Sie das umsetzen k\u00f6nnen. Wir haben einen Dienst eingerichtet, der Word-Dokumente, die von Kunden oder anderen Projektbeteiligten gelieferte werden, mit PHP in PDF-Dokumente konvertiert.","og_url":"https:\/\/uhp.digital\/en\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/","og_site_name":"UHP","article_publisher":"https:\/\/www.facebook.com\/uhpdigital\/","article_published_time":"2020-06-25T14:01:00+00:00","article_modified_time":"2020-12-09T12:16:56+00:00","og_image":[{"width":540,"height":540,"url":"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/02\/FB-Logo@3x.png","type":"image\/png"}],"author":"UHP","twitter_card":"summary_large_image","twitter_misc":{"Written by":"UHP","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#article","isPartOf":{"@id":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/"},"author":{"name":"UHP","@id":"https:\/\/uhp.digital\/#\/schema\/person\/82c263f7a03b60653db3cdd2d4301acb"},"headline":"Wie man Word-Dokumentvorlagen mit PHP bearbeitet und in PDF konvertiert","datePublished":"2020-06-25T14:01:00+00:00","dateModified":"2020-12-09T12:16:56+00:00","mainEntityOfPage":{"@id":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/"},"wordCount":1641,"publisher":{"@id":"https:\/\/uhp.digital\/#organization"},"image":{"@id":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#primaryimage"},"thumbnailUrl":"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/06\/undraw-new-entries-nh-3-h.svg","articleSection":["Tech"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/","url":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/","name":"How to edit word document templates with PHP and convert it to PDF? - UHP","isPartOf":{"@id":"https:\/\/uhp.digital\/#website"},"primaryImageOfPage":{"@id":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#primaryimage"},"image":{"@id":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#primaryimage"},"thumbnailUrl":"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/06\/undraw-new-entries-nh-3-h.svg","datePublished":"2020-06-25T14:01:00+00:00","dateModified":"2020-12-09T12:16:56+00:00","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/uhp.digital\/blog\/word-dokumentvorlagen-mit-php-bearbeiten-und-in-pdf-konvertieren\/#primaryimage","url":"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/06\/undraw-new-entries-nh-3-h.svg","contentUrl":"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/06\/undraw-new-entries-nh-3-h.svg","width":477,"height":362},{"@type":"WebSite","@id":"https:\/\/uhp.digital\/#website","url":"https:\/\/uhp.digital\/","name":"UHP","description":"Delivering digital impact.","publisher":{"@id":"https:\/\/uhp.digital\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/uhp.digital\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/uhp.digital\/#organization","name":"UHP","url":"https:\/\/uhp.digital\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/uhp.digital\/#\/schema\/logo\/image\/","url":"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/01\/uhp-logo.svg","contentUrl":"https:\/\/uhp.digital\/wp-content\/uploads\/2020\/01\/uhp-logo.svg","width":88,"height":40,"caption":"UHP"},"image":{"@id":"https:\/\/uhp.digital\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/uhpdigital\/","https:\/\/www.instagram.com\/uhpdigital\/","https:\/\/www.linkedin.com\/company\/uhp-software\/"]},{"@type":"Person","@id":"https:\/\/uhp.digital\/#\/schema\/person\/82c263f7a03b60653db3cdd2d4301acb","name":"UHP","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/uhp.digital\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c1bc770aea92efb4d58edb8d8e86f9eaa06def97a45852ce534799e57534d6c6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c1bc770aea92efb4d58edb8d8e86f9eaa06def97a45852ce534799e57534d6c6?s=96&d=mm&r=g","caption":"UHP"}}]}},"_links":{"self":[{"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/posts\/4326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/comments?post=4326"}],"version-history":[{"count":10,"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/posts\/4326\/revisions"}],"predecessor-version":[{"id":5899,"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/posts\/4326\/revisions\/5899"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/media\/4217"}],"wp:attachment":[{"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/media?parent=4326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/categories?post=4326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/uhp.digital\/en\/wp-json\/wp\/v2\/tags?post=4326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}