feat(print-area): detect die-cut and safe print area

Keep 22827 content on the sticker when Avery bleed guides or printer drift would otherwise print off the label.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Michael SloanandCursor committed 2026-09-13 14:51:02 -04:00
1 parent ffa4d0cf86
commit e31c5f89bd
10 files changed
+730 -88

No files matched your search

+24 -5
View File
@@ -25,12 +25,19 @@ from .import_settings import ImportSettings
class ImportDocumentDialog(QDialog):
def __init__(self, settings: ImportSettings | None = None, parent=None) -> None:
def __init__(
self,
settings: ImportSettings | None = None,
parent=None,
*,
recommended_inset_in: float = 0.0,
) -> None:
super().__init__(parent)
self.setWindowTitle("Import PDF / Word → Auto-fill 60504 labels")
self.setWindowTitle("Import PDF / Word → Auto-fill labels")
self.setMinimumWidth(520)
self.file_path: Path | None = None
self.settings = settings or ImportSettings()
self.recommended_inset_in = max(0.0, recommended_inset_in)
root = QVBoxLayout(self)
@@ -95,8 +102,14 @@ class ImportDocumentDialog(QDialog):
self.spin_inset.setSingleStep(0.01)
self.spin_inset.setDecimals(3)
self.spin_inset.setSuffix(" in")
self.spin_inset.setValue(self.settings.inset_in)
place_l.addRow("Inset", self.spin_inset)
inset_value = self.settings.inset_in
if inset_value <= 0 and self.recommended_inset_in > 0:
inset_value = self.recommended_inset_in
self.spin_inset.setValue(inset_value)
inset_label = "Inset"
if self.recommended_inset_in > 0:
inset_label = f"Inset (safe {self.recommended_inset_in:.3f}\")"
place_l.addRow(inset_label, self.spin_inset)
self.spin_cx = QDoubleSpinBox()
self.spin_cy = QDoubleSpinBox()
@@ -119,11 +132,17 @@ class ImportDocumentDialog(QDialog):
place_l.addRow("Render DPI", self.spin_dpi)
root.addWidget(place)
note = QLabel(
note_text = (
"Example: a 10-page PDF → 10 labels → 3 Letter sheets (4+4+2).\n"
"Export creates one print PDF with every sheet included.\n"
"Word needs Microsoft Word installed (or export to PDF first)."
)
if self.recommended_inset_in > 0:
note_text += (
f"\nThis template is print-to-edge: a {self.recommended_inset_in:.3f}\" "
"inset keeps text on the sticker if the printer feeds slightly off."
)
note = QLabel(note_text)
note.setWordWrap(True)
note.setStyleSheet("color: #64748b;")
root.addWidget(note)