Skip to content

Instantly share code, notes, and snippets.

@mondwan
Last active June 24, 2018 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mondwan/dbff5ee7a1a18e56d439726248cf198b to your computer and use it in GitHub Desktop.
Save mondwan/dbff5ee7a1a18e56d439726248cf198b to your computer and use it in GitHub Desktop.
page size resolution
from reportlab.lib.pagesizes import A5, landscape
# A5 = (210*mm,148*mm)
LANDSCAPE_A5 = landscape(A5)
PAGE_WIDTH = LANDSCAPE_A5[0]
PAGE_HEIGHT = LANDSCAPE_A5[1]
HORIZONTAL_MARGIN = PAGE_WIDTH / 32
VERTICAL_MARGIN = PAGE_HEIGHT / 16
# 196.875, 129.5
BOX_WIDTH = PAGE_WIDTH - (HORIZONTAL_MARGIN * 2)
BOX_HEIGHT = PAGE_HEIGHT - (VERTICAL_MARGIN * 2)
VENDOR_BOX_WIDTH = BOX_WIDTH / 10 * 6
VENDOR_BOX_HEIGHT = BOX_HEIGHT / 10 * 3
INVOICE_NUMBER_BOX_WIDTH = BOX_WIDTH / 10 * 4
INVOICE_NUMBER_BOX_HEIGHT = BOX_HEIGHT / 10 * 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment