Complete PDF output handler#367
Conversation
Everythnig was alredy prepairt and I just had to make some minor changes. I do not know why this was prepaired but not finished.
There was a problem hiding this comment.
As long as you do not need drawing frames and BOM, this is fine. It does not solve your issue #354 then.
|
@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. |
|
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 |
|
@martinrieder wrote:
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. |
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>
Wire up PDF output (port of upstream PR wireviz#367)
Everything was already prepaired, and I just had to make some minor changes. I do not know why this was prepaired but not finished.