Introduction
Extract metadata and links from a local or remote PDF, and optionally download all referenced PDFs.
Features
Extract metadata and PDF URLs from a given PDF
Works with local and online pdfs
Download all PDFs referenced in the original PDF
Fast, parallel download of references
Output as text or JSON (using the -j flag)
Use as command-line tool or Python package
Compatible with Python 2 and 3
Getting Started
Grab a copy of the code with easy_install or pip, and run it:
$ easy_install -U pdfx ... $ pdfx <pdf-file-or-url>
Run pdfx -h to see the help output:
$ pdfx -h
usage: pdfx [-h] [-d OUTPUT_DIRECTORY] [-j] [-v] [--debug] [--version] pdf
Get infos and links from a PDF, and optionallydownload all referenced PDFs.
See http://www.metachris.com/pdfx for more information.
positional arguments:
pdf Filename or URL of a PDF file
optional arguments:
-h, --help show this help message and exit
-d OUTPUT_DIRECTORY, --download-pdfs OUTPUT_DIRECTORY
Download all referenced PDFs into specified directory
-j, --json Output infos as json (instead of plain text)
-v, --verbose Print all urls (instead of only PDF urls)
--debug Output debug infos
--version show program's version number and exit
Examples
Lets take a look at this paper: https://weakdh.org/imperfect-forward-secrecy.pdf:
$ pdfx https://weakdh.org/imperfect-forward-secrecy.pdf Document infos: - CreationDate = D:20150821110623-04'00' - Creator = LaTeX with hyperref package - ModDate = D:20150821110805-04'00' - PTEX.Fullbanner = This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) kpathsea version 6.1.1 - Pages = 13 - Producer = pdfTeX-1.40.14 - Title = Imperfect Forward Secrecy: How Diffie-Hellman Fails in Practice - Trapped = False 17 PDF URLs: - http://cr.yp.to/factorization/smoothparts-20040510.pdf - http://www.spiegel.de/media/media-35671.pdf - http://www.spiegel.de/media/media-35529.pdf - http://cryptome.org/2013/08/spy-budget-fy13.pdf - http://www.spiegel.de/media/media-35514.pdf - http://www.spiegel.de/media/media-35509.pdf - http://www.spiegel.de/media/media-35515.pdf - http://www.spiegel.de/media/media-35533.pdf - http://www.spiegel.de/media/media-35519.pdf - http://www.spiegel.de/media/media-35522.pdf - http://www.spiegel.de/media/media-35513.pdf - http://www.spiegel.de/media/media-35528.pdf - http://www.spiegel.de/media/media-35526.pdf - http://www.spiegel.de/media/media-35517.pdf - http://www.spiegel.de/media/media-35527.pdf - http://www.spiegel.de/media/media-35520.pdf - http://www.spiegel.de/media/media-35551.pdf
Download all referenced pdfs with ``-d`` (for download-pdfs) to the specified directory (eg. ./):
$ pdfx https://weakdh.org/imperfect-forward-secrecy.pdf -d ./ Document infos: - CreationDate = D:20150821110623-04'00' - Creator = LaTeX with hyperref package - ModDate = D:20150821110805-04'00' - PTEX.Fullbanner = This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) kpathsea version 6.1.1 - Pages = 13 - Producer = pdfTeX-1.40.14 - Title = Imperfect Forward Secrecy: How Diffie-Hellman Fails in Practice - Trapped = False 17 PDF URLs: - http://cr.yp.to/factorization/smoothparts-20040510.pdf - http://www.spiegel.de/media/media-35671.pdf - http://www.spiegel.de/media/media-35529.pdf - http://cryptome.org/2013/08/spy-budget-fy13.pdf - http://www.spiegel.de/media/media-35514.pdf - http://www.spiegel.de/media/media-35509.pdf - http://www.spiegel.de/media/media-35515.pdf - http://www.spiegel.de/media/media-35533.pdf - http://www.spiegel.de/media/media-35519.pdf - http://www.spiegel.de/media/media-35522.pdf - http://www.spiegel.de/media/media-35513.pdf - http://www.spiegel.de/media/media-35528.pdf - http://www.spiegel.de/media/media-35526.pdf - http://www.spiegel.de/media/media-35517.pdf - http://www.spiegel.de/media/media-35527.pdf - http://www.spiegel.de/media/media-35520.pdf - http://www.spiegel.de/media/media-35551.pdf Downloading 17 pdfs to './'... All done!
Usage as Python library
>>> import pdfx
>>> pdf = pdfx.PDFx("filename-or-url.pdf")
>>> print(pdf.get_metadata())
>>> pdf.analyze_text()
>>> print(pdf.get_urls())
>>> pdf.download_pdfs("target-directory")
TODO
Various
Author: Chris Hager <chris@linuxuser.at>
Homepage: http://www.metachris.com/pdfx
License: Apache
Feedback, ideas and pull requests are welcome! If you enhance PDFx please also add yourself to the AUTHORS file!
Metadata
Release files for pdfx 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pdfx-1.0.3.tar.gz | 63.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pdfx-1.0.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 134.6 kB
Release files / pdfx-1.0.3.tar.gz
| Download URL | pdfx-1.0.3.tar.gz |
|---|---|
| Size | 63.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dde28c55b398e9b0e2631d244191696cdc1808e8d754c50225c4280073639bc7
|
|
BLAKE2b-256 checksum How to use checksums |
a1efc08915f0cde0571d5f3c32c290abc470c16dbee6784a582735cefb6e30e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pdfx-1.0.3-py2.py3-none-any.whl
| Download URL | pdfx-1.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 71.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
dbecfe0dde848102c553d90a61eb8dd7c67c31b6a30eb03522d8e0f8414b6594
|
|
BLAKE2b-256 checksum How to use checksums |
a0163ec7632e9b55836bfada853def146611187d7b352ca1f344c73b6df56b13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |