poppler-utils › Wiki › ubuntuusers.de (2024)

Dieser Artikel wurde für die folgendenUbuntu-Versionen getestet:

  • Ubuntu 20.04 Focal Fossa

Du möchtest den Artikel für eine weitere Ubuntu-Version testen? Mitarbeit im Wiki ist immer willkommen! Dazu sind die Hinweise zum Testen von Artikeln zu beachten.

Zum Verständnis dieses Artikels sind folgende Seiten hilfreich:

  1. ⚓︎ Installation von Programmen

  2. ⚓︎ Ein Terminal öffnen

Inhaltsverzeichnis

  1. Installation
  2. Benutzung
    1. pdfinfo
    2. pdffonts
    3. pdftotext
    4. pdftoppm
    5. pdftohtml
    6. pdfimages
    7. pdfunite
    8. pdfseparate
    9. pdftocairo
  3. Links

poppler-utils › Wiki › ubuntuusers.de (1)Die poppler-utils 🇬🇧 sind eine Sammlung von Kommandozeilen-Programmen, mit denen Informationen über PDF-Dokumente gewonnen, die Dokumente in andere Formate umgewandelt oder manipuliert werden können. Dazu wird libpoppler genutzt, welches unter Linux die Standardbibliothek zur Darstellung von PDF-Dokumenten ist, z.B. auch in Evince und Okular.

Dieses Paket enthält folgende (auf Poppler beruhende) Kommandozeilenprogramme:

  • pdfdetach – Listet oder entnimmt eingebettete Dateien (Anhänge)

  • pdffonts – Analyse von Schriften

  • pdfimages – Entnahme von Bildern

  • pdfinfo – Dokumentinformationen

  • pdfseparate – Werkzeug zur Entnahme von Seiten

  • pdfunite – Zusammenführen von PDF-Dateien

  • pdfsig – prüft digitale Signaturen

  • pdftocairo – Umwandlung von PDF nach PNG/JPEG/PDF/PS/EPS/SVG mittels Cairo

  • pdftohtml – Umwandlung von PDF nach HTML

  • pdftoppm – Umwandlung von PDF nach PPM/PNG/JPEG

  • pdftops – Umwandlung von PDF nach PostScript (PS)

  • pdftotext – Entnahme von Text

Installation

Um die Hilfsprogramme nutzen zu können, muss das folgende Paket installiert werden [1]:

  • poppler-utils

Befehl zum Installieren der Pakete:

sudo apt-get install poppler-utils 

Oder mit apturl installieren, Link: apt://poppler-utils

Benutzung

Die Nutzung der verschiedenen Programme aus poppler-utils ist immer relativ ähnlich. Man ruft das entsprechende Programm auf und übergibt als Parameter die zu lesenden PDF-Datei und den gewünschten Namen der Ausgabedatei. Natürlich kennen die einzelnen Programme auch diverse Optionen.

Leider gibt es keine Man-Page für die poppler-utils. Man kann aber jedes der Programme mit der Option -h aufrufen, um eine kurze Hilfe über die verschiedenen Optionen zu bekommen

Ist die PDF-Datei verschlüsselt, so funktionieren Operationen wie Text extrahieren in der Regel nicht. Ob ein PDF-Dokument verschlüsselt ist kann man mit Hilfe von pdfinfo feststellen, welches Teil der poppler-utils ist.

pdfinfo

Wie der Name vermuten lässt, erhält man mit pdfinfo Informationen zum PDF-Dokumenten, wie z.B. [2]

pdfinfo dokument.pdf 
Creator: cairo 1.8.6 (http://cairographics.org)Producer: John DoeTagged: noPages: 3Encrypted: noPage size: 612 x 792 pts (letter)File size: 542783 bytesOptimized: noPDF version: 1.4

Man sieht also, womit und von wem das PDF-Dokument erstellt wurde ("Creator" und "Producer"), wie viele Seite enthalten sind, ob das PDF verschlüsselt ist, welche Seitengröße es hat, wie groß die ganze Datei ist, ob es sich um ein optimiertes PDF handelt und welche PDF-Version das Dokument hat. Besonders die Information, ob das Dokument verschlüsselt ist, kann von Interesse sein, da man aus verschlüsselten PDFs in der Regel keine Texte/Bilder extrahieren kann. Die Angabe zur PDF-Version kann nützlich sein, da nicht alle PDF-Betrachter mit allen (= den neueren) PDF-Versionen umgehen können.

pdffonts

Mit Hilfe dieses Befehls kann festgestellt werden, welche Schriftarten ("Fonts") innerhalb des PDF-Dokuments verwendet werden. Beispiel [2]:

pdffonts dokument.pdf 
name type emb sub uni object ID------------------------------------ ----------------- --- --- --- ---------Verdana CID TrueType yes no yes 5 0TrebuchetMS CID TrueType yes no yes 6 0VerdanaBold CID TrueType yes no yes 7 0DejaVuSerif CID TrueType yes no yes 8 0

Die Spalte emb gibt an, ob die betreffende Schrift in das Dokument eingebettet ist.

pdftotext

Möchte man den kompletten Text aus dem PDF-Dokument extrahieren, so kann man dafür pdftotext nutzen. Der Befehlsaufruf lautet [2]

pdftotext dokument.pdf ausgabe.txt 

Hier wird der Text aus dokument.pdf in die Datei ausgabe.txt geschrieben. Wie gut das Ergebnis ist, hängt grundlegend davon ab, wie komplex das PDF-Dokument ist, also z.B. ob das Ausgangsdokument einfacher Fließtext ist, viele vom Text umflossene Bilder enthält oder sogar mehrspaltig ist. In der Regel muss das kreierte Textdokument immer nachbearbeitet werden, um z.B. überflüssige Leerzeichen und falsche Zeilenumbrüche zu entfernen.

pdftotext kennt u.a. die folgenden Optionen:

Optionen von pdftotext
OptionBeschreibung
-f Nr beginne auf Seite Nr
-l Nr stoppe auf Seite Nr
-htmlmeta erzeugt eine (einfache) HTML-Datei
-enc TYP verwendet das Encoding TYP für die Textdatei
-listenc zeigt alle mögliche Encodings (für -enc) an
-eol TYP das Zeilenende in der Ausgabedatei wird auf TYP gesetzt (mögliche Werte: unix, dos, mac)

pdftoppm

Mit pdftoppm können die Seiten eines PDF-Dokuments in Bilddateien umgewandelt werden, standardmäßig sind dies PPM-Dateien, welche von allen gängigen Grafikbetrachtern gelesen (und konvertiert) werden können.

Der Befehlsaufruf lautet [2]:

pdftoppm dokument.pdf SEITE 

SEITE ist dabei das Präfix für die Namen der Ausgabedateien. Hat eine PDF-Dokument z.B. drei Seiten, so werden die Dateien seite-000.ppm, seite-001.ppm und seite-002.ppm erzeugt. pdftoppm kennt einige Optionen, u.a. auch für das Ausgabeformat:

Optionen von pdftoppm
OptionBeschreibung
-monoAusgabe als monochrome PBM-Datei
-grayAusgabe als PGM-Datei (Grauskala)
-pngAusgabe als PNG-Datei

Des Weiteren gibt es noch diverse Optionen, um die Ausgabegröße und Auflösung festzulegen, welche in der Hilfe nachgelesen werden können.

pdftohtml

Durch pdftohtml können PDF-Dokumente in HTML-Seiten umwandelt werden. Der Aufruf lautet [2]

pdftohtml dokument.pdf seite 

Dabei wird die Datei dokument.pdf in eine eine HTML-Datei Names seite.html umgewandelt. Genau genommen entstehen immer drei HTML-Dateien: Einmal die genannte Hauptdatei plus, in diesem Beispiel, die Seiten seite_ind.html und seites.html. Dies liegt daran, dass die HTML-Ausgabe (nicht mehr ganz zeitgemäß) Frames verwendet, um im linken Frame ein einfaches Inhaltsverzeichnis und im Hauptframe den Inhalt an sich darzustellen. Weiterhin wird der Text komplett über die die "klassischen" HMTL-Tags formiert anstatt CSS-Styles zu verwenden.

Über die Option -xml wird eine XML-Datei anstatt einer HTML-Datei generiert.

Um eine PDF-Datei aus dem Kontextmenü in Nautilus heraus in eine HTML-Datei umzuwandeln, importiert man diese Datei ⮷.

pdfimages

Mit Hilfe von pdfimages lassen sich alle Bilder aus einem PDF-Dokument extrahieren. Die Bilder werden dabei als PPM-Datei gespeichert.

Der Aufruf des Programms erfolgt über

pdfimages dokument.pdf bild 

bild ist dabei das Präfix für die Ausgabedatei(en). Enthält ein PDF z.B. drei Bilder, so werden die Dateien bild-000.ppm, bild-001.ppm und bild-002.ppm generiert. Über die Option -j werden alle im PDF-Dokument enthalten JPEG-Bilder auch als JPEG gespeichert und nicht als PPM.

pdfunite

Mit Hilfe von pdfunite lassen sich mehrere PDF-Dokumente durch Aneinanderhängen zu einem einzigen vereinen.

Der Aufruf des Programms erfolgt über

pdfunite dokument1.pdf dokument2.pdf dokumentN.pdf Ausgabedokument.pdf 

Es kann mit zur Bestimmung der Ausgangsdokumente mit Platzhaltern (*.pdf) gearbeitet werden, wobei die gefundenen Dokumente alphabetisch (Dateiname) sortiert verarbeitet werden.

pdfseparate

Um Seiten aus einem PDF-Dokument zu extrahieren, verwendet man pdfseparate. Der Befehlsaufruf lautet:

pdfseparate dokument.pdf AUSGABE 

In AUSGABE muss mindestens %d angegeben werden, welches bei den Ausgabedateien durch die jeweilige Seitenzahl ersetzt wird.

pdfseparate unterstützt folgende Optionen:

Optionen von pdfseparate
OptionBeschreibung
-f Nr beginne auf Seite Nr
-l Nr stoppe auf Seite Nr

Wenn keine Optionen angegeben werden, extrahiert pdfseparate alle Seiten des Eingabedokuments.

pdftocairo

Konvertiert seitenweise eine PDF-Datei in verschiedene Grafikformate (PNG, JPEG, TIFF, PDF, PS, EPS, SVG). Durch den Befehl pdftocairo --help werden alle Optionen sichtbar.

Der Befehl

pdftocairo dateiname.pdf -png dateiname 

generiert je eine Seite ein PNG-Bild.

Damit wird aus der ersten Seite ein Bild im PNG-Format erzeugt:

pdftocairo -png -singlefile dokument.pdf dokument 

Weitere Parameter lassen umfangreiche Anpassungen zu. So können ausgewählte Seiten umgewandelt werden oder die Ausgabegröße beliebig angepasst werden.
Anhand der Optionen -f und -l kann eine Selektion durchgeführt werden: -f n - bestimmt die erste Seite für die Ausgabe, -l n - bestimmt die letzte Seite für die Ausgabe.

Damit erzeugt pdftocairo aus den Seiten 3 – 8 sechs PNG-Dateien mit einer Breite von 300 Pixel:

pdftocairo -png -scale-to-x 300 -f 3 -l 8 dokument.pdf dokument 

Links

  • PDF Übersichtsartikel

poppler-utils › Wiki › ubuntuusers.de (2024)

FAQs

What is poppler-utils in Ubuntu? ›

Precompiled command-line utilities (based on Poppler) for manipulating PDF files and converting them to other formats.

How to check if poppler is installed? ›

Check if poppler is installed: You can do this by running where poppler in your command prompt. If it's installed, this command should return the path to the poppler executable. Check if poppler is in your PATH: You can do this by running echo %PATH% in your command prompt.

What is the use of poppler in Python? ›

python-poppler is a Python binding to the poppler-cpp library. It allows to read, render, or modify PDF documents.

Is poppler a PDF rendering library? ›

Poppler is a free and open-source software library for rendering Portable Document Format (PDF) documents. Its development is supported by freedesktop.org. Commonly used on Linux systems, it powers the PDF viewers of the GNOME and KDE desktop environments.

What is the difference between Poppler and Ghostscript? ›

However, Ghostscript was created primarily to manage Postscript files, while Poppler—from its inception—was only meant to be a PDF manipulation tool. With Poppler, you can perform any action on PDF files, including creation, merging, and even converting.

What is Util Linux in Ubuntu? ›

util-linux is a standard package distributed by the Linux Kernel Organization for use as part of the Linux operating system.

How to install and use poppler? ›

Other answers have linked to the correct download page for Windows users but do not specify how to install them for the uninitiated.
  1. Go to this page and download the binary of your choice. In this example we will download and use poppler-0.68. ...
  2. Extract the archive file poppler-0.68.0_x86.7z into C:\Program Files .
Aug 22, 2013

How to install poppler in Docker? ›

  1. RUN git clone https://github.com/frescobaldi/python-poppler-qt5.git && cd python-poppler-qt5 && python -m pip install .
  2. # 1. ...
  3. # 2. ...
  4. => [internal] load metadata for docker.io/library/ubuntu:18.04 0.0s.
  5. => [1/6] FROM docker.io/library/ubuntu:18.04 0.0s.
May 31, 2024

Does pdf2image need poppler? ›

Indeed, this library requires Poppler, but it is impossible to add poppler to the requirements. Have you even encounter this? You need to use a packages. txt file in addition to a requirements.

What is libpoppler? ›

The Poppler CPP interface library. The Poppler CPP interface library, called libpoppler-cpp, is a library that allows C++ programmers to easily load and render PDF files using the Poppler library.

How to install poppler through conda? ›

Installing poppler from the conda-forge channel can be achieved by adding conda-forge to your channels with:
  1. conda config --add channels conda-forge conda config --set channel_priority strict. ...
  2. conda install poppler poppler-qt. ...
  3. mamba install poppler poppler-qt. ...
  4. conda search poppler --channel conda-forge.

What are poppler utils? ›

Poppler is a free software utility library for rendering Portable Document Format (PDF) documents. Among the list of very useful features, Poppler enables you to convert . pdf files to .

What is poppler Qt5? ›

The Poppler Qt5 interface library, libpoppler-qt5, is a library that allows Qt5 programmers to easily load and render PDF files. The Poppler Qt5 interface library uses poppler internally to do its job, but the Qt5 programmer will never have to worry about poppler internals.

What is the best PHP library to create a PDF? ›

Effortless PDF Creation in PHP: Exploring the Top Libraries
  • FPDF. If speed and simplicity are your priorities, FPDF is the way to go. ...
  • Dompdf. This library is a dream for web developers. ...
  • wkhtmltopdf. ...
  • Beyond the Basics.
Mar 7, 2024

What is can utils in Linux? ›

Can-utils is a command line Linux utility that contains basic tools which can display, record, generate and replay CAN traffic. Along with these basic operations we can also calculate busload, convert log files and it also contain ISO 15765-2:2016 tools.

What is the use of yum utils in Linux? ›

yum-utils is a collection of tools and programs for managing yum repositories, installing debug packages, source packages, extended information from repositories and administration.

What is CIFS utils in Ubuntu? ›

cifs utility attaches the UNC name (exported network resource) specified as service (using //server/share syntax, where "server" is the server name or IP address and "share" is the name of the share) to the local directory mount-point. Options to mount. cifs are specified as a comma-separated list of key=value pairs.

What is the use of utils in Python? ›

Python Utils is a collection of small Python functions and classes which make common patterns shorter and easier. It is by no means a complete collection but it has served me quite a bit in the past and I will keep extending it.

Top Articles
Latest Posts
Article information

Author: Jonah Leffler

Last Updated:

Views: 6068

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Jonah Leffler

Birthday: 1997-10-27

Address: 8987 Kieth Ports, Luettgenland, CT 54657-9808

Phone: +2611128251586

Job: Mining Supervisor

Hobby: Worldbuilding, Electronics, Amateur radio, Skiing, Cycling, Jogging, Taxidermy

Introduction: My name is Jonah Leffler, I am a determined, faithful, outstanding, inexpensive, cheerful, determined, smiling person who loves writing and wants to share my knowledge and understanding with you.