Move all text above image: title, stock/price, SKU/UPC then picture then barcode
This commit is contained in:
30
disco.py
30
disco.py
@@ -333,27 +333,33 @@ def generate_catalog_pdf(products: list[dict]) -> Path | None:
|
|||||||
abs_bc = str(bc_path.resolve()) if bc_path else None
|
abs_bc = str(bc_path.resolve()) if bc_path else None
|
||||||
|
|
||||||
latex_lines += [
|
latex_lines += [
|
||||||
# Name — bold, large, above the image
|
# Name — bold, large
|
||||||
r"{\Large\bfseries " + safe_title + r"}",
|
r"{\Large\bfseries " + safe_title + r"}",
|
||||||
"",
|
"",
|
||||||
|
r"\vspace{0.15cm}",
|
||||||
|
"",
|
||||||
|
# Stock and price
|
||||||
|
r"{\large " + safe_stock + r" \hfill " + safe_price + r"}",
|
||||||
|
"",
|
||||||
|
r"\vspace{0.1cm}",
|
||||||
|
"",
|
||||||
|
# SKU and UPC
|
||||||
|
r"{\small SKU: \texttt{" + sku + r"} \hfill UPC: \texttt{" + upc + r"}}",
|
||||||
|
"",
|
||||||
r"\vspace{0.3cm}",
|
r"\vspace{0.3cm}",
|
||||||
"",
|
"",
|
||||||
r"\begin{center}",
|
r"\begin{center}",
|
||||||
# Product image — large, centered, with border
|
# Product image — large, centered, with border
|
||||||
r"\fbox{\includegraphics[width=0.7\textwidth,height=0.42\textheight,keepaspectratio]{"
|
r"\fbox{\includegraphics[width=0.7\textwidth,height=0.40\textheight,keepaspectratio]{"
|
||||||
+ abs_img
|
+ abs_img
|
||||||
+ r"}}",
|
+ r"}}",
|
||||||
r"\end{center}",
|
r"\end{center}",
|
||||||
r"\vspace{0.3cm}",
|
|
||||||
"",
|
"",
|
||||||
# Stock and price
|
r"\vfill",
|
||||||
r"{\large " + safe_stock + r" \hfill " + safe_price + r"}",
|
|
||||||
"",
|
|
||||||
r"\vspace{0.5cm}",
|
|
||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Barcode — centered, bordered
|
# Barcode — centered, bordered, pushed to bottom
|
||||||
if abs_bc:
|
if abs_bc:
|
||||||
latex_lines += [
|
latex_lines += [
|
||||||
r"\begin{center}",
|
r"\begin{center}",
|
||||||
@@ -361,17 +367,9 @@ def generate_catalog_pdf(products: list[dict]) -> Path | None:
|
|||||||
+ abs_bc
|
+ abs_bc
|
||||||
+ r"}}",
|
+ r"}}",
|
||||||
r"\end{center}",
|
r"\end{center}",
|
||||||
r"\vspace{0.15cm}",
|
|
||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
|
|
||||||
# SKU and UPC — small text
|
|
||||||
latex_lines += [
|
|
||||||
r"{\small SKU: \texttt{" + sku + r"}}\\",
|
|
||||||
r"{\small UPC: \texttt{" + upc + r"}}",
|
|
||||||
"",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Page break between products (not after last)
|
# Page break between products (not after last)
|
||||||
if i < len(products):
|
if i < len(products):
|
||||||
latex_lines.append(r"\newpage")
|
latex_lines.append(r"\newpage")
|
||||||
|
|||||||
Reference in New Issue
Block a user