Portable Document Format: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 1: Line 1:
__TOC__
A proprietary format owned by Adobe until 2008, when it was released and relicensed as an ISO standard.
A proprietary format owned by Adobe until 2008, when it was released and relicensed as an ISO standard.


http://en.wikipedia.org/wiki/Portable_Document_Format
http://en.wikipedia.org/wiki/Portable_Document_Format
== Readings==


* https://www.vice.com/en/article/pam43n/why-the-pdf-is-secretly-the-worlds-most-important-file-format
* https://www.vice.com/en/article/pam43n/why-the-pdf-is-secretly-the-worlds-most-important-file-format
* https://planetpdf.com/planetpdf/pdfs/warnock_camelot.pdf
* https://planetpdf.com/planetpdf/pdfs/warnock_camelot.pdf


== Free software tools that work with PDF ==
== PDF, Ghostscript, Postscript ==
Thanks to the [[Ghostscript]] project, there are many free software tools that work with postscript.
 
...
 
== F/LOSS tools to make PDFs ==
 
Thanks to the [[Ghostscript]] project, there are many free software tools that work with postscript and PDF.
 
===Canvas based (GUI)===
 
* [[Scribus]] https://www.scribus.net/
* Laidout https://laidout.org/
* Inkscape https://inkscape.org/
 
===Web based (web-to-print)===
 
* your browser (use CTRL+P or CMD+P)
* Weasyprint https://weasyprint.readthedocs.io/
* Paged.js https://www.pagedjs.org/
* wkhtmltopdf https://wkhtmltopdf.org/
 
===Python===
 
* Reportlab https://www.reportlab.com/
* Flat http://xxyxyz.org/flat/
* pyPDF2 https://github.com/mstamy2/PyPDF2
 
===LaTeX based===
 
* LaTeX https://www.latex-project.org/
* ConTeXt  https://wiki.contextgarden.net/Main_Page
 
===Misc===


* pdftk
* poppler
* [[Scribus]]
* [[Imagemagick]]
* [[Imagemagick]]


== Cookbook ==
==PDF manipulating/editing tools==
 
* pdftk (the PDF toolkit) https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
* pdfimages (part of poppler-utils) https://manpages.debian.org/stretch/poppler-utils/pdfimages.1.en.html
* pdfunite (part of poppler-utils) https://manpages.debian.org/stretch/poppler-utils/pdfunite.1.en.html
* pdftotext (part of poppler-utils) https://manpages.debian.org/stretch/poppler-utils/pdftotext.1.en.html
* pdfinfo (part of poppler-utils) https://manpages.debian.org/stretch/poppler-utils/pdfinfo.1.en.html
* pdffonts (part of poppler-utils) https://manpages.debian.org/stretch/poppler-utils/pdffonts.1.en.html
 
==Examples==


apt-get install poppler-utils
===One-liners===


  pdftocairo -png mydoc.pdf
  $ pandoc -f markdown --pdf-engine weasyprint -c stylesheet.css filename.md -o filename.pdf


Creates a series of [[PNG]] files.
$ weasyprint -s stylesheet.css filename.html filename.pdf


== Python tools to manipulate / generate PDF ==
===Reportlab===
* [http://xxyxyz.org/flat/ flat]
* [http://www.reportlab.com/opensource/ reportlab]
* [https://github.com/mstamy2/PyPDF2 pyPDF2]


== Examples ==
<syntaxhighlight lang="python">
An example using reportlab (see http://stackoverflow.com/questions/2252726/how-to-create-pdf-files-in-python)
<source lang="python">
from reportlab.pdfgen import canvas
from reportlab.pdfgen import canvas
from reportlab.lib.units import inch, cm
from reportlab.lib.units import inch, cm
Line 36: Line 73:
c.showPage()
c.showPage()
c.save()
c.save()
</source>
</syntaxhighlight>
 
[[Category:PagedMedia]]
[[Category:Cookbook]]

Revision as of 09:44, 3 October 2023


A proprietary format owned by Adobe until 2008, when it was released and relicensed as an ISO standard.

http://en.wikipedia.org/wiki/Portable_Document_Format

Readings

PDF, Ghostscript, Postscript

...

F/LOSS tools to make PDFs

Thanks to the Ghostscript project, there are many free software tools that work with postscript and PDF.

Canvas based (GUI)

Web based (web-to-print)

Python

LaTeX based

Misc

PDF manipulating/editing tools

Examples

One-liners

$ pandoc -f markdown --pdf-engine weasyprint -c stylesheet.css filename.md -o filename.pdf
$ weasyprint -s stylesheet.css filename.html filename.pdf

Reportlab

from reportlab.pdfgen import canvas
from reportlab.lib.units import inch, cm
c = canvas.Canvas('ex.pdf')
c.drawImage('ar.jpg', 0, 0, 10*cm, 10*cm)
c.showPage()
c.save()