Skip to content

Commit c66441e

Browse files
Merge pull request #8 from ClassicMiniDIY/port-367-pdf-output
Wire up PDF output (port of upstream PR wireviz#367)
2 parents 8a105e7 + 10baef3 commit c66441e

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/wireviz/Harness.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,9 +834,6 @@ def output(
834834
if "csv" in fmt:
835835
# TODO: implement CSV output (preferably using CSV library)
836836
sys.stderr.write("CSV output is not yet supported\n")
837-
if "pdf" in fmt:
838-
# TODO: implement PDF output
839-
sys.stderr.write("PDF output is not yet supported\n")
840837

841838
if filename is None:
842839
# stdout mode — emit each rendered format in the user-requested order
@@ -923,6 +920,9 @@ def _render(
923920
png_bytes = _embed_yaml_in_png(png_bytes, yaml_source)
924921
outputs["png"] = png_bytes
925922

923+
if "pdf" in fmt:
924+
outputs["pdf"] = graph.pipe(format="pdf")
925+
926926
if "gv" in fmt:
927927
outputs["gv"] = graph.source
928928

src/wireviz/wireviz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def parse(
5454
* "gv": the diagram, as a GraphViz source file
5555
* "html": the diagram and (depending on the template) the BOM, as a HTML file
5656
* "png": the diagram, as a PNG raster image
57-
* "pdf": the diagram and (depending on the template) the BOM, as a PDF file
57+
* "pdf": the diagram, as a PDF document (no BOM — see "html" for that)
5858
* "svg": the diagram, as a SVG vector image
5959
* "tsv": the BOM, as a tab-separated text file
6060

src/wireviz/wv_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"g": "gv",
2020
"h": "html",
2121
"p": "png",
22-
# "P": "pdf",
22+
"P": "pdf",
2323
"s": "svg",
2424
"t": "tsv",
2525
}

0 commit comments

Comments
 (0)