Skip to main content

Inkplot

Inkplot makes PDFs and PNGs out of Inkscape SVG documents using a simple YAML file that describes for each image or pdf page page:

  • the source SVG
  • visibiilty for each of the SVG's layers
  • the page's zoom extents

It's purpose is to make it easy to produce PDFs from SVGs where the workflow includes turning layers on and off and zooming around to different spots in the document space.

The project's original aim is to enable the creation of a set of planning documents with title blocks, page numbers, compass rose and scale, etc. with pages that include various systems like water, septic, and electrical with labels and line weights appropriate to the scale.

I've often wanted a tool like this to exist, but only just embarked on the project that's involved enough to justify the effort.

I hope other folks find it useful. Enjoy!

Pages

To keep things brief, inkplot pages can use shared layersets and zoom rectangles:

shared:
  layersets:
    - name: hide-all
      source: farm.svg
      hidden:
        - '**'
    - name: basemap-imagery
      source: farm.svg
      visible: True
      layers:
        - "site>>basemap>>**"
    - name: titleblock-frontpage
      source: farm.svg
      visible:
        - "titleblock>>full extent frame>>boxes"
        - "titleblock>>full extent frame>>mask"
        - "scale>>full extent scale"
  zoom-rectangles:
    - name: whole-site-frame
      id: residences-site-frame-lg
    - name: both-residences-frame
      id: residences-site-frame-sm

To define the PDFs that can be generated using inkplot and the render definition YAML file, A page definition can reference layersets and simply define any additional layers that need to be turned on or off above and beyond the shared layersets listed in include-layersets:

pdfs:
  - name: example_pdf
    pages:
      - name: frontpage
        source: farm.svg
        include-layersets:
          - "hide-all"
          - "basemap-imagery"
          - "titleblock-frontpage"
        layersets:
          - visible: True
            layers:
              - "titleblock>>full extent frame>>title>>overview-basemap"
        include-zoom-rectangle: whole-site-frame

And, because it's a YAML file, we can gain a bit more brevity yet using YAML aliases:

pdfs:
  - name: example_pdf
    pages:
      # this one defines the front page but also makes a template of sorts named
      # pg-imagery-with-titleblock that can be used later
      - &pg-imagery-with-titleblock
        name: frontpage
        source: farm.svg
        include-layersets:
          - "hide-all"
          - "basemap-imagery"
          - "titleblock-frontpage"
        layersets:
          - visible: True
            layers:
              - "titleblock>>full extent frame>>title>>overview-basemap"
        include-zoom-rectangle: whole-site-frame
        
      # this defines a page that includes everything in the frontpage def, but
      # redefines the layersets (keeping the layersets referenced in
      # include-layersets)
      - *pg-imagery-with-titleblock
        name: siteplan
        layersets:
            visible:
              - "titleblock>>full extent frame>>title>>site-plan"
              - "bldgs>>**"
              - "site/infrastructure/fences/**"

To define images, that, like pages, can be generated at the command line, we can include an images section that is very similar to the pages section:

images:
  - name: site-range-hill
    source: farm.svg
    include-layersets:
      - "hide-all"
      - "titleblock-brewery-site"
      - "shared-brewery-site"
    layersets:
      - visible:
          - "proposed>>brewery>>sites 1>>range hill"
      - hidden: []
    include-zoom-rectangle: brewery-site-plan-frame

Using the CLI

To create all defined PDFs and images, use the simple CLI:

inkplot example.yml

and to create individual PDFs and images use:

# produce a single PDF
inkplot example.yml --pdf example_pdf

# produce an individual image
inkplot example.yml --image site-range-hill

And that should do it.

Installing

Installing is as simple as:

pip install inkplot

and you'll need to have Inkscape installed.

Metadata

Release files for inkplot 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inkplot 0.2.1
File Size Uploaded
inkplot-0.2.1.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inkplot 0.2.1
File Interpreter ABI Platform
inkplot-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.8 kB

Release files / inkplot-0.2.1.tar.gz

Download URL inkplot-0.2.1.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5f49b52499f580af4a2d4131343511de38b9ed15529d362759723fa7a94f9c4d
BLAKE2b-256 checksum
How to use checksums
22272a181ecc5bfc336a196df277b36fab0aaa3535ade4227649b325f3a9c8df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / inkplot-0.2.1-py3-none-any.whl

Download URL inkplot-0.2.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf9a684227b137c6571d377d2a3495946fffebfaa27c5c20cc2ded209d2f4db9
BLAKE2b-256 checksum
How to use checksums
4d281099dd1f99c1fb3859861b2f4b2759244ff41240890f91cf6a2fead609fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page