From d8260b3fdeaa3a24afb85025d1f6f8e87e712ec3 Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Fri, 13 Feb 2026 00:25:29 -0700 Subject: [PATCH] Enable PDF output format (port of upstream PR #367) GraphViz natively supports PDF rendering, so this just adds "pdf" to the allowed format list and exposes it via the -f P CLI flag. --- src/wireviz/wv_cli.py | 2 +- src/wireviz/wv_harness.py | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/wireviz/wv_cli.py b/src/wireviz/wv_cli.py index 10c7dbf..9c9a7ca 100644 --- a/src/wireviz/wv_cli.py +++ b/src/wireviz/wv_cli.py @@ -19,7 +19,7 @@ format_codes = { "g": "gv", "h": "html", "p": "png", - # "P": "pdf", # TODO: support PDF + "P": "pdf", "s": "svg", "t": "tsv", } diff --git a/src/wireviz/wv_harness.py b/src/wireviz/wv_harness.py index 209d573..363c4d8 100644 --- a/src/wireviz/wv_harness.py +++ b/src/wireviz/wv_harness.py @@ -440,7 +440,7 @@ class Harness: # graphical output graph = self.graph for f in fmt: - if f in ("png", "svg", "html"): + if f in ("png", "svg", "html", "pdf"): if f == "html": # if HTML format is specified, f = "svg" # generate SVG for embedding into HTML # SVG file will be renamed/deleted later @@ -471,10 +471,7 @@ class Harness: # HTML output if "html" in fmt: generate_html_output(filename, bomlist, self.metadata, self.options) - # PDF output - if "pdf" in fmt: - # TODO: implement PDF output - print("PDF output is not yet supported") + # PDF output is handled by GraphViz in the format loop above # delete SVG if not needed if "html" in fmt and not "svg" in fmt: # SVG file was just needed to generate HTML