how to know current page dimensions #981
-
I want to define some functions for drawing stuff in current page, just using pdf.line() to loop a list of points with x,y coordinates. Is it possible that I can get page dimensions from inside my function? I couldn't find such feature. If it does not exist, I would need to know dimensions in advance and pass them to my function (but I'd prefer not having to be passing around page dimensions, if possible). def mydrawing(points=[])
# code to know current page width and page height?
# pw & ph would be
for p in points:
# code to calculate max and min x,y values of all points in list
for p in points:
# point coordinates will be redefined based on max & min x,y values,
# so my drawing will be proportional to current page size
self.line(... whatever ...)
points = [[30,40], [50,60], ...]
pdf.mydrawing(points) Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
fpdf.w = Page width |
Beta Was this translation helpful? Give feedback.
fpdf.w = Page width
fpdf.h = Page height
fpdf.epw = Effective page width: the page width minus its horizontal margins.
fpdf.eph = Effective page height: the page height minus its vertical margins.