Skip to content

Complete PDF output handler#367

Open
tobiasfalk wants to merge 1 commit into
wireviz:devfrom
tobiasfalk:PDF_out
Open

Complete PDF output handler#367
tobiasfalk wants to merge 1 commit into
wireviz:devfrom
tobiasfalk:PDF_out

Conversation

@tobiasfalk
Copy link
Copy Markdown

@tobiasfalk tobiasfalk commented May 29, 2024

Everything was already prepaired, and I just had to make some minor changes. I do not know why this was prepaired but not finished.

Everythnig was alredy prepairt and I just had to make some minor changes.
I do not know why this was prepaired but not finished.
@amotl amotl changed the title Added final stuff for PDF output Complete PDF output handler Jun 4, 2024
Copy link
Copy Markdown
Contributor

@martinrieder martinrieder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as you do not need drawing frames and BOM, this is fine. It does not solve your issue #354 then.

@tobiasfalk
Copy link
Copy Markdown
Author

@martinrieder yes and no, Yes it does not add frames and so. And No since I originally just wanted a PDF output and was not interested in the frame, since PDF is just a robuster vector graphics format and is less dependent on the interpreter.

@martinrieder
Copy link
Copy Markdown
Contributor

martinrieder commented Jun 15, 2024

Maybe we need to make some destinguishment through another CLI argument that would request BOM output, templates and metadata to be included, which is currently only supported for HTML.

EDIT: Alternatively, the list of output formats for the -f CLI switch might be extended to contain PDF either with or without BOM. See the PR on CLI here:

@kvid
Copy link
Copy Markdown
Collaborator

kvid commented Oct 6, 2024

@martinrieder wrote:

Maybe we need to make some destinguishment through another CLI argument that would request BOM output, templates and metadata to be included, which is currently only supported for HTML.

EDIT: Alternatively, the list of output formats for the -f CLI switch might be extended to contain PDF either with or without BOM.

If you want to include a BOM in the diagram (as in #227) and optionally also a frame, then such extra elements will be added to all graphical output types, and controlling this by different output type specifiers makes no sense to me. A common specifyer for what to include in the diagram is then needed, and the HTML output should be adjusted accordingly to avoid doubled BOM and frame.

SomethingNew71 added a commit to ClassicMiniDIY/WireViz that referenced this pull request May 5, 2026
Implements the ``pdf`` output format that's been a TODO stub since
v0.4.1. Pipes the graph through Graphviz's PDF renderer
(``graph.pipe(format="pdf")``) and dispatches the bytes the same way
PNG goes — to a file in normal mode, to ``sys.stdout.buffer`` in
stdout mode.

Usage:

    wireviz -f P harness.yml                 # produces harness.pdf
    cat harness.yml | wireviz -f P -O - -    # stdout, binary

CLI flag changes:
* ``"P": "pdf"`` un-commented in ``format_codes`` (use ``-f P``)
* "PDF output is not yet supported" stderr warning removed from
  Harness.output()

Adapted from wireviz#367 (originally
by @tobiasfalk, targeting upstream ``dev``). The upstream patch went
through the old ``graph.render()`` + temp-file path — this port uses
the in-memory ``graph.pipe()`` wired up by the stdin/stdout refactor
(PR wireviz#321), so PDF works in both file mode AND stdout mode without
extra plumbing.

Verified:
* ``wireviz -f P harness.yml`` produces a valid PDF (file 1.7).
* ``cat harness.yml | wireviz -f P -O - -`` writes valid PDF to stdout.
* build_examples.py: deterministic outputs (.gv, .bom.tsv) byte-
  identical (no example .yml has been switched to request PDF
  rendering — keeping that out of the regression baseline since PDF
  bytes from graphviz vary by version).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SomethingNew71 added a commit to ClassicMiniDIY/WireViz that referenced this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants