Best command line tool to convert a webpage to a pdf file?

Oliver Grawert ogra at ubuntu.com
Mon Feb 12 10:04:35 UTC 2018


hi,
Am Freitag, den 09.02.2018, 20:49 -0600 schrieb Peng Yu:
> Hi, I have tried wkhtmltopdf. But it can not always guarantee to
> generate the pdf correctly. Does anybody know a tool that can
> generate
> a pdf from a URL reliably?
> 

yes, libreoffice can do that easily ...

libreoffice.writer --headless --norestore --writer \
  --convert-to pdf $URL

but note that there is no way to define the output filename, it will
use the name of the input file, so if your URL ends in / you end up
with a file just called ".html" (you probably want to wrap a script
around the line above to give the file a proper name)

ciao
	oli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20180212/fbc4cd4b/attachment.sig>


More information about the ubuntu-users mailing list