forked from reingart/pyfpdf
-
Notifications
You must be signed in to change notification settings - Fork 330
Closed
Labels
Description
I discovered fpdf2 and tried it out. Thanks for this interesting library.
Describe the bug
Error details
I couldn't make
pdf.set_display_mode(zoom=25)
works to produce a PDF that opens at a scale of 25%...
Minimal code
Please include some minimal Python code reproducing your issue:
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
pdf.set_display_mode(zoom=50)
pdf.output('test_zoom.pdf')If you don't know how to build a minimal reproducible example, please check this tutorial: https://stackoverflow.com/help/minimal-reproducible-example
Environment
Please provide the following information:
- Operating System: Mac OSX
- Python version: Python 3.9.18
fpdf2version used: 2.7.5
Proposed fix
If I'm not mistaken...
In output.py > _finalize_catalog() after :
# zoom_mode is a number, not one of the allowed strings:
zoom_config = ["/XYZ", "null", "null", str(fpdf.zoom_mode / 100)]add :
zoom_config = [
pdf_ref(first_page_obj.id),
*zoom_config]Lucas-C