GNU/Linux >> Linux Esercitazione >  >> Debian

Come convertire HTML in PDF con HTMLDoc su Debian 10

HTMLDOC è un programma open source che può essere utilizzato per convertire file sorgente HTML e Markdown in file PostScript e PDF. Esistono due tipi di file HTML, 1) documenti strutturati con intestazioni come H1, H2, ecc. noti come libri e 2) documenti non strutturati senza intestazioni noti come pagine Web.

In questo tutorial, spiegheremo come installare HTMLDOC su Debian 10 e convertire un file HTML in pdf.

Requisiti

  • Un server che esegue Debian 10.
  • Sul tuo server è configurata una password di root.

Per iniziare

Innanzitutto, aggiorna il tuo sistema con l'ultima versione eseguendo il comando seguente:

apt-get update -y
apt-get upgrade -y

Una volta aggiornato il sistema, riavvialo per applicare le modifiche alla configurazione.

Installa HTMLDOC

Per impostazione predefinita, HTMLDOC è disponibile nel repository predefinito di Debian 10. Puoi installarlo semplicemente eseguendo il seguente comando:

apt-get install htmldoc -y

Dopo aver installato HTMLDOC, puoi elencare tutte le opzioni disponibili con HTMLDOC con il seguente comando:

htmldoc --help

Crea il tuo primo PDF da HTML

Innanzitutto, crea un file test.html con il seguente comando:

nano test.html

Aggiungi il seguente codice:

<html>
<head>
    <title>This is my first PDF</title>
</head>
<body>
    This is the body of my first PDF.
</body>
</html>

Salva e chiudi il file, quando hai finito.

Ora, esegui il seguente comando per convertire test.html in test.pdf con il seguente comando:

htmldoc --webpage -f test.pdf test.html

Il comando precedente genererà un nuovo file pdf denominato test.pdf.

Congratulazioni! hai installato con successo HTMLDOC sul server Debian 10.


Debian
  1. Come installare Steam con Steam Play su Debian 10 Buster

  2. Come installare WebDAV con Lighttpd su Debian 8 (Jessie)

  3. Come installare WonderCMS con Nginx su Debian 11

  4. Come convertire un PDF in JPG con la riga di comando in Linux?

  5. Come convertire PDF in scala di grigi

Come convertire una pagina Web in PDF in Linux

Come installare Debian 11 (Bullseye) con schermate

Come configurare LAMP con Debian 11

Come configurare Samba Server con Debian 11

Come installare Itch con Debian 11

Come installare phpMyAdmin con Nginx su Debian 11