Skip to content

Commit 1912bf4

Browse files
committed
feat(printing): make watermark slightly to the left and make it more detailed
1 parent 5a1fab3 commit 1912bf4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

intranet/apps/printing/views.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from django.shortcuts import redirect, render
1717
from django.template.loader import get_template
1818
from django.utils.text import slugify
19+
from django.utils import timezone
1920
from pypdf import PdfReader, PdfWriter
2021
from reportlab.pdfgen import canvas
2122
from sentry_sdk import add_breadcrumb, capture_exception
@@ -353,13 +354,13 @@ def add_watermark(pdf_path: str, obj) -> str:
353354
packet = BytesIO()
354355
c = canvas.Canvas(packet)
355356

356-
text = f"{obj.user.username} , {obj.id}"
357+
text = f"{obj.user.username}, ID: {obj.id}, {obj.num_pages} pages, {obj.time}"
357358

358359
c.setFont("Helvetica", 6)
359360
c.setFillGray(0.2)
360361

361362
page_width = float(page.mediabox.width)
362-
c.drawString(page_width - 150, 12, text)
363+
c.drawString(page_width - 175, 12, text)
363364

364365
c.save()
365366
packet.seek(0)

0 commit comments

Comments
 (0)