Feature #10715
closedwkhtmltopdf ersetzen: puppeteer
0%
Description
Prio4 von Nicola
Varianten:
- pupeteer https://pptr.dev/
- wkhtmltopdf VS pupeteer: https://medium.com/coletiv-stories/puppeteer-vs-wkhtmltopdf-and-why-i-created-a-new-module-9466eb1db7d1
- https://crpdf.evens.eu/ (alt)
- Pandoc
- generate latex using a twig template (actually a separate feature)
- Chrome Headless: https://developers.google.com/web/updates/2017/04/headless-chrome#create_a_pdf_dom
Tools¶
- Artikel zum Thema: https://www.paperplane.app/blog/modern-html-to-pdf-conversion-2019/
Diese koennen vermutlich alle kein JS, sind dafuer aber als LIB oder API sehr schnell:
Files
Related issues
Updated by Carsten Rose almost 4 years ago
- Subject changed from wkhtmltopdf ersetzen to wkhtmltopdf ersetzen: puppeteer
Updated by Carsten Rose almost 3 years ago
- Priority changed from Normal to High
- Target version changed from next5 to next3
Updated by Carsten Rose almost 3 years ago
Test¶
- Test von Fabric: http://webwork16.math.uzh.ch/crose/qfq/index.php?id=annotatefabric&form=annotateGraphic&r=1
- Test von Calendar: http://webwork16.math.uzh.ch/crose/qfq/index.php?id=96
Umgebung¶
- webwork16 (Ubuntu 18):
- crpdf als linux Binary installiert: https://github.com/JorgenEvens/crPDF/
# Test als npm - Installation hat funktioniert, aber das Binary blieb haengen # FALSCH: CR hat einfach nur nicht lange genug gewartet. Beim ersten Start wird in das Home des users ein kompletter Chrome geladen!!! >300MB [root@host] $ npm install -g crpdf # Aufruf bleibt haengen $ crpdf https://math.uzh.ch final.pdf # Installation des fertigen Linux Pakets https://github.com/JorgenEvens/crPDF/releases [root@host] mv /var/tmp/crpdf /usr/local/bin/crpdf-pkg # Aufruf OK fuer root UND fuer www-data [root@host] cd; crpdf-pkg 'http://webwork16.math.uzh.ch/crose/qfq/index.php?id=annotatefabric&form=annotateGraphic&r=1' final.pdf [www-data@host] cd; crpdf-pkg 'http://webwork16.math.uzh.ch/crose/qfq/index.php?id=annotatefabric&form=annotateGraphic&r=1' final.pdf
Updated by Carsten Rose almost 3 years ago
- Assignee changed from Carsten Rose to Benjamin Baer
- Start date changed from 04.06.2020 to 08.06.2021
Liste der wkhtml Optionen: https://wkhtmltopdf.org/usage/wkhtmltopdf.txt
Ziel: zumindest die aktuell verwendeten Optionen sollten funktionieren.
Wichtig sind die Cookies. Achtung : in dem --cookie-jar File werden alle aktuellen Cookies kopiert (QFQ, FE, PHP, ...)
user arguments ------------------ --margin-bottom=20mm --footer-left="Seite: [page]/[toPage]" --footer-right="1234, UZH Doc.Mobility" --footer-font-size=8 --footer-spacing=10 QFQ added arguments ------------------- --cookie-jar ‘/tmp/qfq.cookie….’ '--custom-header User-Agent ' . escapeshellarg($_SERVER['HTTP_USER_AGENT'] ?? '') --custom-header-propagation
Updated by Benjamin Baer almost 3 years ago
Damit ich mal wieder meine Browser Fenster aufraeumen kann, hier noch einige Punkte zum jetzigen Status.
Unser crpdf: https://git.math.uzh.ch/utilities/crpdf-custom
Download builds: https://www.math.uzh.ch/repo/?dir=crpdf
About Cookies:
Bug in old pupeteer: https://github.com/puppeteer/puppeteer/issues/717
Cookies and Pupetteer uebergeben: https://stackoverflow.com/questions/50418994/pass-signed-cookie-to-puppeteer
Multiple Cookies: https://stackoverflow.com/questions/50584770/passing-multiple-cookies-to-puppeteer
Spread Syntax: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax
Set Cookie has no effect: https://github.com/puppeteer/puppeteer/issues/1342
Browserfetcher problems: Newer versions of browserFetcher don't support the current getStandardVersion anymore.
Pupeteer v10 uses Chromium 92.0.4512.0, see top of: https://github.com/puppeteer/puppeteer/blob/v10.0.0/docs/api.md
To get the slug to download the version (eg 885287 for linux chrome 92.0.4512.0), go to: http://omahaproxy.appspot.com/
Download brings error that it wasn't found with 885287
https://github.com/puppeteer/puppeteer/blob/v10.0.0/docs/api.md#class-browserfetcher
About NPM:
cmd: https://nodejs.org/en/knowledge/command-line/how-to-parse-command-line-arguments/
Updated by Carsten Rose almost 3 years ago
- File qfq.cookie.8ZORgh qfq.cookie.8ZORgh added
Updated by Carsten Rose almost 3 years ago
- crpdf (Puppeteer) von Benj: https://git.math.uzh.ch/utilities/crPDF/-/tree/master
- Das json Array muss wie folgt aussehen:
{"cookies": [ { "name": "test", "value": "3fh822ji4f244", "domain": "w16.math.uzh.ch", "path": "/my/" }, { "name": "mondieux", "value": "oh mon dieux", "domain": "w16.math.uzh.ch", "path": "/my/" } ]}
Updated by Carsten Rose over 2 years ago
- Target version changed from next3 to next2
Updated by Carsten Rose over 2 years ago
- Related to Bug #10704: wkhtml problem rendering fullCalendar.js / fabric.js >> successor: puppeteer added
Updated by Carsten Rose over 2 years ago
- Status changed from New to Closed
- Target version changed from next2 to 355
Updated by Carsten Rose over 2 years ago
- Target version changed from 355 to 21.12.0