feat: add document templates (Letter, A4, web, print CMYK)
This commit is contained in:
parent
23697670f8
commit
94baff6050
7 changed files with 278 additions and 0 deletions
33
config/templates/A4.svg
Normal file
33
config/templates/A4.svg
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- A4 portrait -->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="793.7008"
|
||||
height="1122.5197"
|
||||
viewBox="0 0 793.7008 1122.5197"
|
||||
version="1.1"
|
||||
id="svg-a4">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="1.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
units="mm">
|
||||
</sodipodi:namedview>
|
||||
<title>A4</title>
|
||||
<g inkscape:label="Background" inkscape:groupmode="layer" id="layer-background" style="display:inline" />
|
||||
<g inkscape:label="Guides" inkscape:groupmode="layer" id="layer-guides" style="display:inline" />
|
||||
<g inkscape:label="Artwork" inkscape:groupmode="layer" id="layer-artwork" style="display:inline" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
33
config/templates/Letter.svg
Normal file
33
config/templates/Letter.svg
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- US Letter portrait -->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="816.0000"
|
||||
height="1056.0000"
|
||||
viewBox="0 0 816.0000 1056.0000"
|
||||
version="1.1"
|
||||
id="svg-letter">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="1.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="in"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
units="in">
|
||||
</sodipodi:namedview>
|
||||
<title>Letter</title>
|
||||
<g inkscape:label="Background" inkscape:groupmode="layer" id="layer-background" style="display:inline" />
|
||||
<g inkscape:label="Guides" inkscape:groupmode="layer" id="layer-guides" style="display:inline" />
|
||||
<g inkscape:label="Artwork" inkscape:groupmode="layer" id="layer-artwork" style="display:inline" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
37
config/templates/Print-CMYK-A4.svg
Normal file
37
config/templates/Print-CMYK-A4.svg
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- A4 with 3mm bleed. Note: Inkscape is RGB-native; set CMYK values manually. -->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="793.7008"
|
||||
height="1122.5197"
|
||||
viewBox="0 0 793.7008 1122.5197"
|
||||
version="1.1"
|
||||
id="svg-print-cmyk-a4">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="1.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
units="mm">
|
||||
<sodipodi:guide position="-11.3386,11.3386" orientation="1,0" />
|
||||
<sodipodi:guide position="805.0394,11.3386" orientation="1,0" />
|
||||
<sodipodi:guide position="11.3386,-11.3386" orientation="0,1" />
|
||||
<sodipodi:guide position="11.3386,1133.8583" orientation="0,1" />
|
||||
</sodipodi:namedview>
|
||||
<title>Print-CMYK-A4</title>
|
||||
<g inkscape:label="Background" inkscape:groupmode="layer" id="layer-background" style="display:inline" />
|
||||
<g inkscape:label="Guides" inkscape:groupmode="layer" id="layer-guides" style="display:inline" />
|
||||
<g inkscape:label="Artwork" inkscape:groupmode="layer" id="layer-artwork" style="display:inline" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
37
config/templates/Print-CMYK-Letter.svg
Normal file
37
config/templates/Print-CMYK-Letter.svg
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- US Letter with 3mm bleed. Note: Inkscape is RGB-native; set CMYK values manually. -->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="816.0000"
|
||||
height="1056.0000"
|
||||
viewBox="0 0 816.0000 1056.0000"
|
||||
version="1.1"
|
||||
id="svg-print-cmyk-letter">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="1.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="in"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
units="in">
|
||||
<sodipodi:guide position="-11.3386,11.3386" orientation="1,0" />
|
||||
<sodipodi:guide position="827.3386,11.3386" orientation="1,0" />
|
||||
<sodipodi:guide position="11.3386,-11.3386" orientation="0,1" />
|
||||
<sodipodi:guide position="11.3386,1067.3386" orientation="0,1" />
|
||||
</sodipodi:namedview>
|
||||
<title>Print-CMYK-Letter</title>
|
||||
<g inkscape:label="Background" inkscape:groupmode="layer" id="layer-background" style="display:inline" />
|
||||
<g inkscape:label="Guides" inkscape:groupmode="layer" id="layer-guides" style="display:inline" />
|
||||
<g inkscape:label="Artwork" inkscape:groupmode="layer" id="layer-artwork" style="display:inline" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
33
config/templates/Web-1280x720.svg
Normal file
33
config/templates/Web-1280x720.svg
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- HD web canvas (smaller) -->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="1280.0000"
|
||||
height="720.0000"
|
||||
viewBox="0 0 1280.0000 720.0000"
|
||||
version="1.1"
|
||||
id="svg-web-1280x720">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="1.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
units="px">
|
||||
</sodipodi:namedview>
|
||||
<title>Web-1280x720</title>
|
||||
<g inkscape:label="Background" inkscape:groupmode="layer" id="layer-background" style="display:inline" />
|
||||
<g inkscape:label="Guides" inkscape:groupmode="layer" id="layer-guides" style="display:inline" />
|
||||
<g inkscape:label="Artwork" inkscape:groupmode="layer" id="layer-artwork" style="display:inline" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
33
config/templates/Web-1920x1080.svg
Normal file
33
config/templates/Web-1920x1080.svg
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- HD web canvas -->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="1920.0000"
|
||||
height="1080.0000"
|
||||
viewBox="0 0 1920.0000 1080.0000"
|
||||
version="1.1"
|
||||
id="svg-web-1920x1080">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="1.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="px"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
units="px">
|
||||
</sodipodi:namedview>
|
||||
<title>Web-1920x1080</title>
|
||||
<g inkscape:label="Background" inkscape:groupmode="layer" id="layer-background" style="display:inline" />
|
||||
<g inkscape:label="Guides" inkscape:groupmode="layer" id="layer-guides" style="display:inline" />
|
||||
<g inkscape:label="Artwork" inkscape:groupmode="layer" id="layer-artwork" style="display:inline" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
72
scripts/gen_templates.py
Normal file
72
scripts/gen_templates.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Generate Illuscape document templates."""
|
||||
from pathlib import Path
|
||||
|
||||
TEMPLATES_DIR = Path("config/templates")
|
||||
|
||||
def mm_to_px(mm: float) -> float:
|
||||
return mm * 3.7795275591 # 96 dpi
|
||||
|
||||
def in_to_px(inches: float) -> float:
|
||||
return inches * 96.0
|
||||
|
||||
def svg(name: str, width_px: float, height_px: float,
|
||||
units: str, bleed_mm: float = 0.0, note: str = "") -> str:
|
||||
import math
|
||||
bleed_px = mm_to_px(bleed_mm)
|
||||
guides = ""
|
||||
if bleed_mm > 0:
|
||||
guides = f"""
|
||||
<sodipodi:guide position="{-bleed_px:.4f},{bleed_px:.4f}" orientation="1,0" />
|
||||
<sodipodi:guide position="{width_px + bleed_px:.4f},{bleed_px:.4f}" orientation="1,0" />
|
||||
<sodipodi:guide position="{bleed_px:.4f},{-bleed_px:.4f}" orientation="0,1" />
|
||||
<sodipodi:guide position="{bleed_px:.4f},{height_px + bleed_px:.4f}" orientation="0,1" />"""
|
||||
comment = f"<!-- {note} -->" if note else ""
|
||||
return f"""<?xml version="1.0" encoding="UTF-8"?>
|
||||
{comment}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="{width_px:.4f}"
|
||||
height="{height_px:.4f}"
|
||||
viewBox="0 0 {width_px:.4f} {height_px:.4f}"
|
||||
version="1.1"
|
||||
id="svg-{name.lower().replace(' ', '-')}">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="1.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:document-units="{units}"
|
||||
showgrid="false"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
units="{units}">{guides}
|
||||
</sodipodi:namedview>
|
||||
<title>{name}</title>
|
||||
<g inkscape:label="Background" inkscape:groupmode="layer" id="layer-background" style="display:inline" />
|
||||
<g inkscape:label="Guides" inkscape:groupmode="layer" id="layer-guides" style="display:inline" />
|
||||
<g inkscape:label="Artwork" inkscape:groupmode="layer" id="layer-artwork" style="display:inline" />
|
||||
</svg>
|
||||
"""
|
||||
|
||||
specs = [
|
||||
("Letter", in_to_px(8.5), in_to_px(11), "in", 0, "US Letter portrait"),
|
||||
("A4", mm_to_px(210), mm_to_px(297), "mm", 0, "A4 portrait"),
|
||||
("Web-1920x1080", 1920, 1080, "px", 0, "HD web canvas"),
|
||||
("Web-1280x720", 1280, 720, "px", 0, "HD web canvas (smaller)"),
|
||||
("Print-CMYK-Letter", in_to_px(8.5), in_to_px(11), "in", 3, "US Letter with 3mm bleed. Note: Inkscape is RGB-native; set CMYK values manually."),
|
||||
("Print-CMYK-A4", mm_to_px(210), mm_to_px(297), "mm", 3, "A4 with 3mm bleed. Note: Inkscape is RGB-native; set CMYK values manually."),
|
||||
]
|
||||
|
||||
for name, w, h, units, bleed, note in specs:
|
||||
path = TEMPLATES_DIR / f"{name}.svg"
|
||||
path.write_text(svg(name, w, h, units, bleed, note))
|
||||
print(f"✓ {path}")
|
||||
Loading…
Reference in a new issue