Bernd Wurst commited on 2025-10-23 12:33:23
Zeige 2 geänderte Dateien mit 43 Einfügungen und 2 Löschungen.
| ... | ... |
@@ -148,6 +148,12 @@ class PDF(object): |
| 148 | 148 |
height += (self.line_height + self.line_padding) * len(part.vat) |
| 149 | 149 |
# Für den Rechnungsbetrag |
| 150 | 150 |
height += self.line_height + self.line_padding |
| 151 |
+ elif isinstance(part, InvoiceImage): |
|
| 152 |
+ height = (part.imagedata.height / part.dpi) * inch |
|
| 153 |
+ if part.caption: |
|
| 154 |
+ left, right = self.leftcontent, self.rightcontent |
|
| 155 |
+ height += (len(self._splitToWidth(part.caption, right - left, self.font, |
|
| 156 |
+ self.default_font_size)) * self.line_height) + self.line_padding |
|
| 151 | 157 |
return height |
| 152 | 158 |
|
| 153 | 159 |
def _tableHead(self, part): |
| ... | ... |
@@ -658,8 +664,13 @@ class PDF(object): |
| 658 | 664 |
self.canvas.drawInlineImage(part.imagedata, x, self.y - height, width=width, height=height) |
| 659 | 665 |
self.y -= self.line_padding + height |
| 660 | 666 |
if part.caption: |
| 661 |
- self.canvas.drawString(x, self.y - self.font_height, part.caption) |
|
| 662 |
- self.y -= self._lineHeight() |
|
| 667 |
+ self.canvas.setFont(self.font, self.default_font_size) |
|
| 668 |
+ left, right = self.leftcontent, self.rightcontent |
|
| 669 |
+ lines = self._splitToWidth(part.caption, right - left, self.font, self.default_font_size) |
|
| 670 |
+ for line in lines: |
|
| 671 |
+ self.canvas.drawString(left, self.y - self.font_height, line) |
|
| 672 |
+ self.y -= self._lineHeight(self.default_font_size) |
|
| 673 |
+ self.y -= self.line_padding |
|
| 663 | 674 |
else: |
| 664 | 675 |
raise NotImplementedError("Cannot handle part of type %s" % type(part))
|
| 665 | 676 |
self.y -= (0.5 * cm) |
| ... | ... |
@@ -34,6 +34,36 @@ data = {
|
| 34 | 34 |
'info_headline': None, |
| 35 | 35 |
'info_text': None, |
| 36 | 36 |
'mwst': Decimal('19.0')},
|
| 37 |
+ {'anzahl': Decimal('1.00'),
|
|
| 38 |
+ 'beschreibung': 'Testposten', |
|
| 39 |
+ 'betrag': Decimal('7.000'),
|
|
| 40 |
+ 'brutto': 1, |
|
| 41 |
+ 'datum': datetime.date(2023, 9, 20), |
|
| 42 |
+ 'einheit': 'Stk', |
|
| 43 |
+ 'enddatum': None, |
|
| 44 |
+ 'info_headline': None, |
|
| 45 |
+ 'info_text': None, |
|
| 46 |
+ 'mwst': Decimal('19.0')},
|
|
| 47 |
+ {'anzahl': Decimal('1.00'),
|
|
| 48 |
+ 'beschreibung': 'Testposten', |
|
| 49 |
+ 'betrag': Decimal('7.000'),
|
|
| 50 |
+ 'brutto': 1, |
|
| 51 |
+ 'datum': datetime.date(2023, 9, 20), |
|
| 52 |
+ 'einheit': 'Stk', |
|
| 53 |
+ 'enddatum': None, |
|
| 54 |
+ 'info_headline': None, |
|
| 55 |
+ 'info_text': None, |
|
| 56 |
+ 'mwst': Decimal('19.0')},
|
|
| 57 |
+ {'anzahl': Decimal('1.00'),
|
|
| 58 |
+ 'beschreibung': 'Testposten', |
|
| 59 |
+ 'betrag': Decimal('7.000'),
|
|
| 60 |
+ 'brutto': 1, |
|
| 61 |
+ 'datum': datetime.date(2023, 9, 20), |
|
| 62 |
+ 'einheit': 'Stk', |
|
| 63 |
+ 'enddatum': None, |
|
| 64 |
+ 'info_headline': None, |
|
| 65 |
+ 'info_text': None, |
|
| 66 |
+ 'mwst': Decimal('19.0')},
|
|
| 37 | 67 |
{'anzahl': Decimal('12.00'),
|
| 38 | 68 |
'beschreibung': 'Testposten', |
| 39 | 69 |
'betrag': Decimal('8.000'),
|
| 40 | 70 |