Skip to main content

a simple presentation utility that turns inkscape SVGs into multi-page pdfs with configurable layer visibility and zoom definitions

Project description

Inkplot

Inkplot makes a PDF out of Inkscape SVG documents using a simple YAML file that describes for each 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

So 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:

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:

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/**"

Using the CLI

To create a PDF with, use the simple CLI:

inkplot example.yml /tmp/example.pdf

And that should do it.

Installing

Installing is as simple as:

pip install inkplot

and you'll need to have Inkscape installed.

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

inkplot-0.1.2.tar.gz (12.3 kB view hashes)

Uploaded Source

Built Distribution

inkplot-0.1.2-py3-none-any.whl (12.2 kB view hashes)

Uploaded Python 3

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