Skip to content

Commit

Permalink
Add extra PDF fields
Browse files Browse the repository at this point in the history
  • Loading branch information
WillB97 committed Dec 20, 2024
1 parent 5ad45f1 commit bc562d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions april_vision/cli/marker_generator/marker_modes/mode_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from reportlab.graphics.shapes import Drawing
from reportlab.pdfgen import canvas

from april_vision._version import __version__
from april_vision.cli.utils import get_tag_family
from april_vision.marker import MarkerType

Expand Down Expand Up @@ -46,6 +47,7 @@ def main(args: argparse.Namespace) -> None:
marker_family=args.marker_family
)
combined_pdf = canvas.Canvas(combined_filename, pagesize=page_size.vec_pixels)
combined_pdf.setAuthor(f"april_vision {__version__}")

if args.split:
page_size = CustomPageSize(page_size.width * 2, page_size.height)
Expand Down
4 changes: 4 additions & 0 deletions april_vision/cli/marker_generator/marker_modes/mode_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from reportlab.graphics.shapes import Drawing
from reportlab.pdfgen import canvas

from april_vision._version import __version__
from april_vision.cli.utils import get_tag_family
from april_vision.marker import MarkerType

Expand Down Expand Up @@ -79,8 +80,10 @@ def main(args: argparse.Namespace) -> None:
marker_family=args.marker_family
)
combined_pdf = canvas.Canvas(combined_filename, pagesize=page_size.vec_pixels)
combined_pdf.setAuthor(f"april_vision {__version__}")

for markers in marker_tiles_for_page:
LOGGER.info(f"Generating page {combined_pdf.getPageNumber()}")
output_img = Drawing(page_size.vec_pixels.x, page_size.vec_pixels.y)

for index, marker in enumerate(markers):
Expand Down Expand Up @@ -140,6 +143,7 @@ def main(args: argparse.Namespace) -> None:
# canvas DPI is 72
output_img.scale(72 / DPI, 72 / DPI)
output_img.drawOn(combined_pdf, 0, 0)

# Complete page
combined_pdf.showPage()

Expand Down

0 comments on commit bc562d4

Please sign in to comment.