[{"data":1,"prerenderedAt":831},["Reactive",2],{"/guides/html-to-pdf-php":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"dateModified":10,"author":11,"faq":12,"body":22,"_type":826,"_id":827,"_source":828,"_file":829,"_extension":830},"/guides/html-to-pdf-php","guides",false,"","PHP HTML to PDF: When Dompdf Breaks Your Flexbox","Dompdf and mPDF printed our invoice totals as \"Subtotal$6,600.00\". The CSS that fixes Dompdf, and which PHP and Laravel packages keep your app's CSS.","2026-12-02","Cyril Nicodème",[13,16,19],{"question":14,"answer":15},"Can I convert HTML to PDF in PHP without installing anything?","Yes. A request to an HTML-to-PDF API like PDFShift needs only PHP's curl extension. Dompdf needs only Composer, but it renders CSS 2.1, so check your template against its limits first.",{"question":17,"answer":18},"Which PHP library supports flexbox and grid?","None of the PHP-only libraries in our test: Dompdf's README says it doesn't support flexbox or grid, and mPDF printed our flexbox rows jammed. Routes that use Chrome or Chromium support both: Browsershot, chrome-php/chrome and the PDFShift API.",{"question":20,"answer":21},"What is the best HTML to PDF converter for PHP?","PDFShift, once your PDFs use your app's own CSS: flexbox, grid and scripts come out as they do in Chrome, with nothing installed on your server. For one template written in CSS 2.1 that you control, Dompdf is fast, small and needs only Composer.",{"type":23,"children":24,"toc":810},"root",[25,33,62,69,83,95,108,124,131,136,144,149,154,167,173,178,180,400,414,420,433,477,483,503,512,517,538,647,653,658,667,686,731,761,767,772,776,781,785,790],{"type":26,"tag":27,"props":28,"children":29},"element","p",{},[30],{"type":31,"value":32},"text","If your invoice's totals come out of Dompdf as \"Subtotal$6,600.00\", with the label and the amount touching, the row is a flexbox and Dompdf doesn't do flexbox. mPDF printed ours the same way. For one fixed template you own, three lines of table CSS fix it in Dompdf. Once your PDFs share your app's CSS (flexbox, grid, a script), stop rewriting them for Dompdf and send that HTML to Chromium. One curl call to PDFShift does that, with nothing to install on your server.",{"type":26,"tag":34,"props":35,"children":37},"guide-figure",{"caption":36},"The totals box of the same invoice HTML, from PDFShift and from Dompdf 3.1.6. Our test, December 2, 2026.",[38],{"type":26,"tag":39,"props":40,"children":42},"guide-page-pair",{":names":41},"[\"PDFShift API\", \"Dompdf\"]",[43,54],{"type":26,"tag":27,"props":44,"children":45},{},[46],{"type":26,"tag":47,"props":48,"children":53},"img",{"alt":49,"height":50,"src":51,"width":52},"The invoice totals from PDFShift: Subtotal $6,600.00, Tax (20%) $1,320.00 and Total due $7,920.00, each label on the left and its amount on the right.",210,"/images/guides/html-to-pdf-php-pdfshift-totals.webp",640,[],{"type":26,"tag":27,"props":55,"children":56},{},[57],{"type":26,"tag":47,"props":58,"children":61},{"alt":59,"height":50,"src":60,"width":52},"The invoice totals from Dompdf: Subtotal$6,600.00, Tax (20%)$1,320.00 and Total due$7,920.00, each amount pressed against its label.","/images/guides/html-to-pdf-php-dompdf-totals.webp",[],{"type":26,"tag":63,"props":64,"children":66},"h2",{"id":65},"how-do-you-convert-html-to-pdf-in-php-with-dompdf",[67],{"type":31,"value":68},"How do you convert HTML to PDF in PHP with Dompdf?",{"type":26,"tag":27,"props":70,"children":71},{},[72,74,81],{"type":31,"value":73},"Dompdf is a PHP library that turns HTML and CSS into a PDF with its own layout engine. There's no browser and no binary to install: ",{"type":26,"tag":75,"props":76,"children":78},"code",{"className":77},[],[79],{"type":31,"value":80},"composer require dompdf/dompdf",{"type":31,"value":82},", then:",{"type":26,"tag":84,"props":85,"children":90},"pre",{"code":86,"language":87,"meta":7,"className":88},"\u003C?php\n// Dompdf 3.1.6, https://github.com/dompdf/dompdf\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Dompdf\\Dompdf;\n\n$dompdf = new Dompdf(['isRemoteEnabled' => true]);\n$dompdf->loadHtml(file_get_contents(__DIR__ . '/invoice.html'));\n$dompdf->setPaper('A4', 'portrait');\n$dompdf->render();\nfile_put_contents(__DIR__ . '/invoice.pdf', $dompdf->output());\n","php",[89],"language-php",[91],{"type":26,"tag":75,"props":92,"children":93},{"__ignoreMap":7},[94],{"type":31,"value":86},{"type":26,"tag":27,"props":96,"children":97},{},[98,100,106],{"type":31,"value":99},"On our invoice of 40 line items it took 0.06 seconds and wrote a 6 KB file of 3 pages, with the table's header row repeated on each one. It got one thing wrong: the totals box, three flexbox rows with ",{"type":26,"tag":75,"props":101,"children":103},{"className":102},[],[104],{"type":31,"value":105},"justify-content: space-between",{"type":31,"value":107},", came out as one run of text per row.",{"type":26,"tag":27,"props":109,"children":110},{},[111,113,122],{"type":31,"value":112},"That's Dompdf working as designed. Its ",{"type":26,"tag":114,"props":115,"children":119},"a",{"href":116,"rel":117},"https://github.com/dompdf/dompdf",[118],"nofollow",[120],{"type":31,"value":121},"README",{"type":31,"value":123}," says it handles \"most CSS 2.1 and a few CSS3 properties\", and it lists what it doesn't do: no flexbox (issue #971), no grid (#2988), and a table row must fit on a single page (#98). The inline script in our invoice didn't run either. Fonts take work too: for any character outside Windows ANSI, the README says you must supply an external font.",{"type":26,"tag":125,"props":126,"children":128},"h3",{"id":127},"the-fix-lay-the-row-out-as-a-table",[129],{"type":31,"value":130},"The fix: lay the row out as a table",{"type":26,"tag":27,"props":132,"children":133},{},[134],{"type":31,"value":135},"We left the HTML alone and added three rules that turn each totals row into a two-cell table, a CSS 2.1 layout:",{"type":26,"tag":84,"props":137,"children":139},{"code":138},".totals div { display: table; width: 100%; }\n.totals span { display: table-cell; }\n.totals span + span { text-align: right; }\n",[140],{"type":26,"tag":75,"props":141,"children":142},{"__ignoreMap":7},[143],{"type":31,"value":138},{"type":26,"tag":27,"props":145,"children":146},{},[147],{"type":31,"value":148},"Dompdf then printed \"Subtotal\" on the left and \"$6,600.00\" on the right, same 3 pages, in 0.08 seconds. The same rules did nothing in mPDF 8.3.2, where the totals stayed jammed.",{"type":26,"tag":27,"props":150,"children":151},{},[152],{"type":31,"value":153},"That's the trade. A fix like this is fine for one invoice that rarely changes. But every flex or grid layout in the template needs its own rewrite, and from then on your PDF template is a second copy of your layout, written in older CSS, that drifts from your app's stylesheet. If your designers work in Tailwind or your charts draw with a script, you'll keep paying that price.",{"type":26,"tag":27,"props":155,"children":156},{},[157,159,165],{"type":31,"value":158},"mPDF is the other PHP-only library. It also skips flexbox and scripts, and it's a bigger install: 93 MB in ",{"type":26,"tag":75,"props":160,"children":162},{"className":161},[],[163],{"type":31,"value":164},"vendor/",{"type":31,"value":166},", 87 MB of which are fonts. It's licensed GPL-2.0-only, so check it with whoever signs off on your licences.",{"type":26,"tag":63,"props":168,"children":170},{"id":169},"which-php-html-to-pdf-package-uses-which-engine",[171],{"type":31,"value":172},"Which PHP HTML to PDF package uses which engine?",{"type":26,"tag":27,"props":174,"children":175},{},[176],{"type":31,"value":177},"The package name rarely says what renders your HTML.",{"type":31,"value":179},"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",{"type":26,"tag":181,"props":182,"children":183},"table",{},[184,218],{"type":26,"tag":185,"props":186,"children":187},"thead",{},[188],{"type":26,"tag":189,"props":190,"children":191},"tr",{},[192,198,203,208,213],{"type":26,"tag":193,"props":194,"children":195},"th",{},[196],{"type":31,"value":197},"Package",{"type":26,"tag":193,"props":199,"children":200},{},[201],{"type":31,"value":202},"Engine",{"type":26,"tag":193,"props":204,"children":205},{},[206],{"type":31,"value":207},"Flexbox and grid",{"type":26,"tag":193,"props":209,"children":210},{},[211],{"type":31,"value":212},"Runs JavaScript",{"type":26,"tag":193,"props":214,"children":215},{},[216],{"type":31,"value":217},"Adds to your server",{"type":26,"tag":219,"props":220,"children":221},"tbody",{},[222,266,292,319,346,373],{"type":26,"tag":189,"props":223,"children":224},{},[225,235,243,251,258],{"type":26,"tag":226,"props":227,"children":228},"td",{},[229],{"type":26,"tag":230,"props":231,"children":232},"strong",{},[233],{"type":31,"value":234},"PDFShift API (PHP's curl)",{"type":26,"tag":226,"props":236,"children":237},{},[238],{"type":26,"tag":230,"props":239,"children":240},{},[241],{"type":31,"value":242},"Chromium",{"type":26,"tag":226,"props":244,"children":245},{},[246],{"type":26,"tag":230,"props":247,"children":248},{},[249],{"type":31,"value":250},"Yes",{"type":26,"tag":226,"props":252,"children":253},{},[254],{"type":26,"tag":230,"props":255,"children":256},{},[257],{"type":31,"value":250},{"type":26,"tag":226,"props":259,"children":260},{},[261],{"type":26,"tag":230,"props":262,"children":263},{},[264],{"type":31,"value":265},"Nothing",{"type":26,"tag":189,"props":267,"children":268},{},[269,274,279,283,287],{"type":26,"tag":226,"props":270,"children":271},{},[272],{"type":31,"value":273},"spatie/browsershot",{"type":26,"tag":226,"props":275,"children":276},{},[277],{"type":31,"value":278},"Chrome through Puppeteer",{"type":26,"tag":226,"props":280,"children":281},{},[282],{"type":31,"value":250},{"type":26,"tag":226,"props":284,"children":285},{},[286],{"type":31,"value":250},{"type":26,"tag":226,"props":288,"children":289},{},[290],{"type":31,"value":291},"Node 22+, Puppeteer, Chrome",{"type":26,"tag":189,"props":293,"children":294},{},[295,300,305,310,314],{"type":26,"tag":226,"props":296,"children":297},{},[298],{"type":31,"value":299},"chrome-php/chrome (not tested)",{"type":26,"tag":226,"props":301,"children":302},{},[303],{"type":31,"value":304},"Chrome, driven from PHP",{"type":26,"tag":226,"props":306,"children":307},{},[308],{"type":31,"value":309},"Yes, it's Chrome",{"type":26,"tag":226,"props":311,"children":312},{},[313],{"type":31,"value":309},{"type":26,"tag":226,"props":315,"children":316},{},[317],{"type":31,"value":318},"A Chrome or Chromium 65+ binary",{"type":26,"tag":189,"props":320,"children":321},{},[322,327,332,337,341],{"type":26,"tag":226,"props":323,"children":324},{},[325],{"type":31,"value":326},"dompdf/dompdf",{"type":26,"tag":226,"props":328,"children":329},{},[330],{"type":31,"value":331},"Its own CSS 2.1 engine",{"type":26,"tag":226,"props":333,"children":334},{},[335],{"type":31,"value":336},"No",{"type":26,"tag":226,"props":338,"children":339},{},[340],{"type":31,"value":336},{"type":26,"tag":226,"props":342,"children":343},{},[344],{"type":31,"value":345},"9.7 MB of PHP",{"type":26,"tag":189,"props":347,"children":348},{},[349,354,359,364,368],{"type":26,"tag":226,"props":350,"children":351},{},[352],{"type":31,"value":353},"mpdf/mpdf",{"type":26,"tag":226,"props":355,"children":356},{},[357],{"type":31,"value":358},"Its own engine",{"type":26,"tag":226,"props":360,"children":361},{},[362],{"type":31,"value":363},"No (our test)",{"type":26,"tag":226,"props":365,"children":366},{},[367],{"type":31,"value":336},{"type":26,"tag":226,"props":369,"children":370},{},[371],{"type":31,"value":372},"93 MB of PHP and fonts",{"type":26,"tag":189,"props":374,"children":375},{},[376,381,386,391,395],{"type":26,"tag":226,"props":377,"children":378},{},[379],{"type":31,"value":380},"knplabs/snappy",{"type":26,"tag":226,"props":382,"children":383},{},[384],{"type":31,"value":385},"wkhtmltopdf, archived in 2023",{"type":26,"tag":226,"props":387,"children":388},{},[389],{"type":31,"value":390},"Not tested",{"type":26,"tag":226,"props":392,"children":393},{},[394],{"type":31,"value":390},{"type":26,"tag":226,"props":396,"children":397},{},[398],{"type":31,"value":399},"The wkhtmltopdf binary",{"type":26,"tag":27,"props":401,"children":402},{},[403,405,412],{"type":31,"value":404},"Snappy runs wkhtmltopdf, which won't get fixes: its GitHub repository has been ",{"type":26,"tag":114,"props":406,"children":409},{"href":407,"rel":408},"https://github.com/wkhtmltopdf/wkhtmltopdf",[118],[410],{"type":31,"value":411},"archived and read-only since January 2, 2023",{"type":31,"value":413},". TCPDF is a different kind of tool: you build the PDF with PHP calls instead of HTML, and its own README says it's in maintenance-only mode, with new work going into tc-lib-pdf.",{"type":26,"tag":63,"props":415,"children":417},{"id":416},"html-to-pdf-in-laravel-your-composerjson-already-picked-the-engine",[418],{"type":31,"value":419},"HTML to PDF in Laravel: your composer.json already picked the engine",{"type":26,"tag":27,"props":421,"children":422},{},[423,425,431],{"type":31,"value":424},"Most Laravel apps reach these engines through a wrapper, so check ",{"type":26,"tag":75,"props":426,"children":428},{"className":427},[],[429],{"type":31,"value":430},"composer.json",{"type":31,"value":432}," before you blame your CSS:",{"type":26,"tag":434,"props":435,"children":436},"ul",{},[437,448,458],{"type":26,"tag":438,"props":439,"children":440},"li",{},[441,446],{"type":26,"tag":230,"props":442,"children":443},{},[444],{"type":31,"value":445},"barryvdh/laravel-dompdf",{"type":31,"value":447}," (3.1.2) runs Dompdf. Everything in the Dompdf section above applies, including the three-line table fix for your flexbox rows.",{"type":26,"tag":438,"props":449,"children":450},{},[451,456],{"type":26,"tag":230,"props":452,"children":453},{},[454],{"type":31,"value":455},"barryvdh/laravel-snappy",{"type":31,"value":457}," runs Snappy, so wkhtmltopdf, and you download that binary yourself and keep it on every server.",{"type":26,"tag":438,"props":459,"children":460},{},[461,466,468,475],{"type":26,"tag":230,"props":462,"children":463},{},[464],{"type":31,"value":465},"spatie/laravel-pdf",{"type":31,"value":467}," (version 2) runs the driver you configure, Browsershot by default. Its other drivers are Gotenberg, Cloudflare, WeasyPrint, Dompdf and Chrome. Spatie's docs say the Browsershot, Gotenberg, Cloudflare and Chrome drivers handle grid and flexbox. They call the Dompdf driver \"",{"type":26,"tag":114,"props":469,"children":472},{"href":470,"rel":471},"https://spatie.be/docs/laravel-pdf/v2/introduction",[118],[473],{"type":31,"value":474},"ideal for simpler PDFs that don't need advanced layout features",{"type":31,"value":476},".\"",{"type":26,"tag":63,"props":478,"children":480},{"id":479},"keep-your-css-php-html-to-pdf-with-chrome",[481],{"type":31,"value":482},"Keep your CSS: PHP HTML to PDF with Chrome",{"type":26,"tag":27,"props":484,"children":485},{},[486,488,494,496,502],{"type":31,"value":487},"Spatie's Browsershot sends your HTML to Chrome through Puppeteer and saves what Chrome prints. ",{"type":26,"tag":75,"props":489,"children":491},{"className":490},[],[492],{"type":31,"value":493},"composer require spatie/browsershot",{"type":31,"value":495},", ",{"type":26,"tag":75,"props":497,"children":499},{"className":498},[],[500],{"type":31,"value":501},"npm install puppeteer",{"type":31,"value":82},{"type":26,"tag":84,"props":504,"children":507},{"code":505,"language":87,"meta":7,"className":506},"\u003C?php\n// spatie/browsershot 5.5.2 with Puppeteer 26.0.0, https://spatie.be/docs/browsershot/v5\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Spatie\\Browsershot\\Browsershot;\n\nBrowsershot::html(file_get_contents(__DIR__ . '/invoice.html'))\n    ->format('A4')\n    ->showBackground()\n    ->save(__DIR__ . '/invoice.pdf');\n",[89],[508],{"type":26,"tag":75,"props":509,"children":510},{"__ignoreMap":7},[511],{"type":31,"value":505},{"type":26,"tag":27,"props":513,"children":514},{},[515],{"type":31,"value":516},"The PDF came out right: each total's label and amount apart, header row repeated, the script ran, 3 pages, 121 KB. Each call took about 0.7 seconds on our Mac, starting and closing its own Chrome.",{"type":26,"tag":27,"props":518,"children":519},{},[520,522,528,530,536],{"type":31,"value":521},"The cost is what it puts on your server. Browsershot 5 needs Node 22 or newer and Puppeteer 23 or newer, and Puppeteer brings its own Chrome. On our Mac that was 33 MB of ",{"type":26,"tag":75,"props":523,"children":525},{"className":524},[],[526],{"type":31,"value":527},"node_modules",{"type":31,"value":529}," and a 390 MB Chrome download. npm 11 skipped Puppeteer's install script by default, so Chrome didn't download until we ran ",{"type":26,"tag":75,"props":531,"children":533},{"className":532},[],[534],{"type":31,"value":535},"npx puppeteer browsers install chrome",{"type":31,"value":537},". That's a step to remember in every deploy. chrome-php/chrome drives Chrome straight from PHP without Node, but you still install and update the Chrome binary yourself.",{"type":26,"tag":34,"props":539,"children":541},{"caption":540},"What each route adds to the server, on disk. PHP packages measured in vendor/, Browsershot's Node packages and Chrome download measured on our Mac. Browsershot also needs Node, which isn't counted here. Our test, December 2, 2026.",[542],{"type":26,"tag":543,"props":544,"children":547},"div",{"role":47,"ariaLabel":545,"style":546},"What each PHP route adds to the server, in MB, on one scale from 0 to 440 MB. PDFShift API through PHP's curl: nothing. Dompdf: 9.7 MB. mPDF: 93 MB, 87 MB of it fonts. Browsershot: 33 MB of Node packages plus a 390 MB Chrome download, about 423 MB, plus Node itself.","font-size:14px;line-height:1.4",[548,571,597,620],{"type":26,"tag":543,"props":549,"children":551},{"style":550},"padding:10px 0",[552,567],{"type":26,"tag":543,"props":553,"children":555},{"style":554},"display:flex;justify-content:space-between;gap:12px;margin-bottom:6px",[556,562],{"type":26,"tag":557,"props":558,"children":560},"span",{"style":559},"font-weight:600;color:#0A0C3D",[561],{"type":31,"value":234},{"type":26,"tag":557,"props":563,"children":565},{"style":564},"font-weight:600;color:#0A0C3D;white-space:nowrap",[566],{"type":31,"value":265},{"type":26,"tag":543,"props":568,"children":570},{"style":569},"display:flex;height:18px;border-radius:4px;overflow:hidden;background:#FFFFFF",[],{"type":26,"tag":543,"props":572,"children":574},{"style":573},"border-top:1px solid #DBE4F2;padding:10px 0",[575,590],{"type":26,"tag":543,"props":576,"children":577},{"style":554},[578,584],{"type":26,"tag":557,"props":579,"children":581},{"style":580},"color:#0A0C3D",[582],{"type":31,"value":583},"Dompdf",{"type":26,"tag":557,"props":585,"children":587},{"style":586},"color:#0A0C3D;white-space:nowrap",[588],{"type":31,"value":589},"9.7 MB",{"type":26,"tag":543,"props":591,"children":592},{"style":569},[593],{"type":26,"tag":543,"props":594,"children":596},{"style":595},"width:2.2%;background:#4C556D",[],{"type":26,"tag":543,"props":598,"children":599},{"style":573},[600,613],{"type":26,"tag":543,"props":601,"children":602},{"style":554},[603,608],{"type":26,"tag":557,"props":604,"children":605},{"style":580},[606],{"type":31,"value":607},"mPDF (87 MB of it fonts)",{"type":26,"tag":557,"props":609,"children":610},{"style":586},[611],{"type":31,"value":612},"93 MB",{"type":26,"tag":543,"props":614,"children":615},{"style":569},[616],{"type":26,"tag":543,"props":617,"children":619},{"style":618},"width:21.1%;background:#4C556D",[],{"type":26,"tag":543,"props":621,"children":622},{"style":573},[623,636],{"type":26,"tag":543,"props":624,"children":625},{"style":554},[626,631],{"type":26,"tag":557,"props":627,"children":628},{"style":580},[629],{"type":31,"value":630},"Browsershot (33 MB Node packages + 390 MB Chrome)",{"type":26,"tag":557,"props":632,"children":633},{"style":586},[634],{"type":31,"value":635},"about 423 MB",{"type":26,"tag":543,"props":637,"children":638},{"style":569},[639,643],{"type":26,"tag":543,"props":640,"children":642},{"style":641},"width:7.5%;background:#4C556D",[],{"type":26,"tag":543,"props":644,"children":646},{"style":645},"width:88.6%;background:#FF9D28",[],{"type":26,"tag":63,"props":648,"children":650},{"id":649},"html-to-pdf-api-in-php-with-curl",[651],{"type":31,"value":652},"HTML to PDF API in PHP with curl",{"type":26,"tag":27,"props":654,"children":655},{},[656],{"type":31,"value":657},"PDFShift renders your HTML in Chromium on our servers, so the CSS and scripts your app already uses come out as they do in Chrome, and nothing gets installed on yours. It's one POST with PHP's curl extension:",{"type":26,"tag":84,"props":659,"children":662},{"code":660,"language":87,"meta":7,"className":661},"\u003C?php\n// PDFShift API v3, https://docs.pdfshift.io/\n$ch = curl_init('https://api.pdfshift.io/v3/convert/pdf');\ncurl_setopt_array($ch, [\n    CURLOPT_POST => true,\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_HTTPHEADER => [\n        'X-API-Key: ' . getenv('PDFSHIFT_API_KEY'),\n        'Content-Type: application/json',\n    ],\n    CURLOPT_POSTFIELDS => json_encode([\n        'source' => file_get_contents(__DIR__ . '/invoice.html'),\n        'format' => 'A4',\n        'use_print' => true,\n    ]),\n]);\n$pdf = curl_exec($ch);\nif (curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) {\n    throw new RuntimeException('PDFShift error: ' . $pdf);\n}\nfile_put_contents(__DIR__ . '/invoice.pdf', $pdf);\n",[89],[663],{"type":26,"tag":75,"props":664,"children":665},{"__ignoreMap":7},[666],{"type":31,"value":660},{"type":26,"tag":27,"props":668,"children":669},{},[670,676,678,684],{"type":26,"tag":75,"props":671,"children":673},{"className":672},[],[674],{"type":31,"value":675},"source",{"type":31,"value":677}," takes your HTML or a URL, and ",{"type":26,"tag":75,"props":679,"children":681},{"className":680},[],[682],{"type":31,"value":683},"use_print",{"type":31,"value":685}," renders with your print CSS. We got the same result as Browsershot: 3 pages, the header row repeated, each total's label and amount apart, the script ran, a 35 KB file. Each request took 2.6 to 3.1 seconds from our machine, network round trip included. A document up to 5 MB costs 1 credit.",{"type":26,"tag":27,"props":687,"children":688},{},[689,691,697,699,705,707,713,715,721,723,729],{"type":31,"value":690},"The same request takes more options, each one more key in that JSON body. Add ",{"type":26,"tag":75,"props":692,"children":694},{"className":693},[],[695],{"type":31,"value":696},"header",{"type":31,"value":698}," to print \"Page 2 of 3\" on every page, ",{"type":26,"tag":75,"props":700,"children":702},{"className":701},[],[703],{"type":31,"value":704},"wait_for",{"type":31,"value":706}," to hold the conversion until your charts finish drawing, ",{"type":26,"tag":75,"props":708,"children":710},{"className":709},[],[711],{"type":31,"value":712},"watermark",{"type":31,"value":714}," to stamp the PDF with text, ",{"type":26,"tag":75,"props":716,"children":718},{"className":717},[],[719],{"type":31,"value":720},"protection",{"type":31,"value":722}," to set a user and owner password, or ",{"type":26,"tag":75,"props":724,"children":726},{"className":725},[],[727],{"type":31,"value":728},"webhook",{"type":31,"value":730}," to get a POST on your server when a conversion is done, so a big batch doesn't keep your PHP workers waiting.",{"type":26,"tag":27,"props":732,"children":733},{},[734,736,743,745,751,753,759],{"type":31,"value":735},"We've run conversions since 2018, on servers in France, and we don't store your documents by default. PDFShift holds ",{"type":26,"tag":114,"props":737,"children":740},{"href":738,"rel":739},"https://www.capterra.com/p/184246/PDFShift/reviews/",[118],[741],{"type":31,"value":742},"4.8 stars from 65 reviews on Capterra",{"type":31,"value":744},". ",{"type":26,"tag":114,"props":746,"children":748},{"href":747},"/register/",[749],{"type":31,"value":750},"Create a free account",{"type":31,"value":752}," for 50 credits a month, no card needed. The same call with custom headers, cookies or an S3 upload is in ",{"type":26,"tag":114,"props":754,"children":756},{"href":755},"/guides/php/curl/",[757],{"type":31,"value":758},"our PHP curl guides",{"type":31,"value":760},".",{"type":26,"tag":63,"props":762,"children":764},{"id":763},"frequently-asked-questions",[765],{"type":31,"value":766},"Frequently asked questions",{"type":26,"tag":125,"props":768,"children":770},{"id":769},"can-i-convert-html-to-pdf-in-php-without-installing-anything",[771],{"type":31,"value":14},{"type":26,"tag":27,"props":773,"children":774},{},[775],{"type":31,"value":15},{"type":26,"tag":125,"props":777,"children":779},{"id":778},"which-php-library-supports-flexbox-and-grid",[780],{"type":31,"value":17},{"type":26,"tag":27,"props":782,"children":783},{},[784],{"type":31,"value":18},{"type":26,"tag":125,"props":786,"children":788},{"id":787},"what-is-the-best-html-to-pdf-converter-for-php",[789],{"type":31,"value":20},{"type":26,"tag":27,"props":791,"children":792},{},[793,795,801,803,809],{"type":31,"value":794},"PDFShift, once your PDFs use your app's own CSS: flexbox, grid and scripts come out as they do in Chrome, with nothing installed on your server. For one template written in CSS 2.1 that you control, Dompdf is fast, small and needs only Composer. If you're choosing in another language, we ran the same kind of test for ",{"type":26,"tag":114,"props":796,"children":798},{"href":797},"/guides/html-to-pdf-python/",[799],{"type":31,"value":800},"Python",{"type":31,"value":802}," and ",{"type":26,"tag":114,"props":804,"children":806},{"href":805},"/guides/html-to-pdf-java/",[807],{"type":31,"value":808},"Java",{"type":31,"value":760},{"title":7,"searchDepth":811,"depth":811,"links":812},2,[813,817,818,819,820,821],{"id":65,"depth":811,"text":68,"children":814},[815],{"id":127,"depth":816,"text":130},3,{"id":169,"depth":811,"text":172},{"id":416,"depth":811,"text":419},{"id":479,"depth":811,"text":482},{"id":649,"depth":811,"text":652},{"id":763,"depth":811,"text":766,"children":822},[823,824,825],{"id":769,"depth":816,"text":14},{"id":778,"depth":816,"text":17},{"id":787,"depth":816,"text":20},"markdown","content:guides:html-to-pdf-php.md","content","guides/html-to-pdf-php.md","md",1796486661802]