Skip to main content

PDF <-> Write document converter

Project description

pdftowrite: PDF <-> Write with text

A utility that converts PDF to Stylus Labs Write document with text, and vice versa.

How does it work

pdftowrite converts PDF pages to SVG paths, adds an invisible but selectable text layer to each page, and merges them into a Write document.

writetopdf converts a Write document to a PDF.

Why do I need writetopdf? Write itself can export PDF

The PDF exporter of Write does not support some features (e.g. Unicode text, multi-coords tspans, etc.), but writetopdf does.

If I convert PDF -> Write -> PDF, Is the latter PDF is 100% the same as the former?

No, the program does not guarantee it. pdftowrite converts PDF pages to SVG paths, so original text elements are deleted. Instead, a text layer is added to the page as mentioned earlier.

Install

pip install --user pdftowrite

Requirements

pdftowrite:

  • Poppler
  • Inkscape (either native or flatpak)
  • gzip

writetopdf:

  • wkhtmltopdf
  • PDFtk(pdftk-java) or Poppler
  • gzip

You need to manually install the packages. e.g.:

  • Debian/Ubuntu: sudo apt install poppler-utils inkscape gzip wkhtmltopdf pdftk
  • Fedora: sudo dnf install poppler inkscape gzip wkhtmltopdf pdftk
  • Arch: sudo pacman -S poppler inkscape gzip wkhtmltopdf pdftk

Example

pdftowrite example.pdf
writetopdf example.svgz

Usage

pdftowrite

usage: pdftowrite [-h] [-v] [-o OUTPUT] [-m {mixed,poppler,inkscape}] [-C]
                  [-d DPI] [-g PAGES] [-u NODUP_PAGES] [-Z] [-s SCALE] [-x X]
                  [-y Y] [-X XRULING] [-Y YRULING] [-l MARGIN_LEFT]
                  [-p PAPERCOLOR] [-r RULECOLOR]
                  FILE

Convert PDF to Stylus Labs Write document

positional arguments:
  FILE                  A pdf file

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -o OUTPUT, --output OUTPUT
                        Specify output filename
  -m {mixed,poppler,inkscape}, --mode {mixed,poppler,inkscape}
                        Specify render mode (default: mixed)
  -C, --no-compat-mode  Turn off Write compatibility mode
  -d DPI, --dpi DPI     Specify resolution for bitmaps and rasterized filters
                        (default: 96)
  -g PAGES, --pages PAGES
                        Specify pages to convert (e.g. "1 2 3", "1-3")
                        (default: all)
  -u NODUP_PAGES, --nodup-pages NODUP_PAGES
                        Specify no-dup pages (e.g. "1 2 3", "1-3") (default:
                        all)
  -Z, --nozip           Do not compress output
  -s SCALE, --scale SCALE
                        Scale page size (default: 1.0)
  -x X                  Specify the x coordinate of the viewport of <svg>
                        (default: 10.0)
  -y Y                  Specify the y coordinate of the viewport of <svg>
                        (default: 10.0)
  -X XRULING, --xruling XRULING
                        Specify x rulling (default: 0.0)
  -Y YRULING, --yruling YRULING
                        Specify y rulling (default: 40.0)
  -l MARGIN_LEFT, --margin-left MARGIN_LEFT
                        Specify margin left (default: 100.0)
  -p PAPERCOLOR, --papercolor PAPERCOLOR
                        Specify paper color (default: #FFFFFF)
  -r RULECOLOR, --rulecolor RULECOLOR
                        Specify rule color (default: #9F0000FF)

writetopdf

usage: writetopdf [-h] [-v] [-o OUTPUT] [-g PAGES] [-s SCALE] FILE

Convert Stylus Labs Write document to PDF

positional arguments:
  FILE                  A Write document

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -o OUTPUT, --output OUTPUT
                        Specify output filename
  -g PAGES, --pages PAGES
                        Specify pages to convert (e.g. "1 2 3", "1-3")
                        (default: all)
  -s SCALE, --scale SCALE
                        Scale page size (default: 1.0)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdftowrite-2021.3.31.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

pdftowrite-2021.3.31-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file pdftowrite-2021.3.31.tar.gz.

File metadata

  • Download URL: pdftowrite-2021.3.31.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for pdftowrite-2021.3.31.tar.gz
Algorithm Hash digest
SHA256 01f10cf689d1f0cb6fbe9a7c99cd4b67980cc0deec663bbb0bb0fd0a72e8bf7b
MD5 a2baebe6d8cada448494bb006973d922
BLAKE2b-256 6a8dbe7434baeaf2259d92461423706d8b2595e8142cc29b8ac6b4c2fadac767

See more details on using hashes here.

File details

Details for the file pdftowrite-2021.3.31-py3-none-any.whl.

File metadata

  • Download URL: pdftowrite-2021.3.31-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for pdftowrite-2021.3.31-py3-none-any.whl
Algorithm Hash digest
SHA256 fc0609aa34b40c263eec017bd2d1779202ee2533d055497e50ab2ac5f0f9b341
MD5 ea8ee3c53df22ee957d362a4e1d703a9
BLAKE2b-256 2f7609810d48b24c7ae8580360cd506d243f68f43a15b8e9c0e58d9cf6e4b7b3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page