@@ -508,7 +508,6 @@ def __init__(
508
508
DictionaryObject .__init__ (self )
509
509
self .pdf = pdf
510
510
self .inline_images : Optional [Dict [str , ImageFile ]] = None
511
- # below Union for mypy but actually Optional[List[str]]
512
511
self .indirect_reference = indirect_reference
513
512
if not is_null_or_none (indirect_reference ):
514
513
assert indirect_reference is not None , "mypy"
@@ -1116,11 +1115,11 @@ def merge_page(
1116
1115
"""
1117
1116
Merge the content streams of two pages into one.
1118
1117
1119
- Resource references
1120
- (i.e. fonts) are maintained from both pages. The mediabox/cropbox/etc
1121
- of this page are not altered. The parameter page's content stream will
1122
- be added to the end of this page's content stream, meaning that it will
1123
- be drawn after, or "on top" of this page.
1118
+ Resource references (e.g. fonts) are maintained from both pages.
1119
+ The mediabox, cropbox, etc of this page are not altered.
1120
+ The parameter page's content stream will
1121
+ be added to the end of this page's content stream,
1122
+ meaning that it will be drawn after, or "on top" of this page.
1124
1123
1125
1124
Args:
1126
1125
page2: The page to be merged into this one. Should be
@@ -1569,31 +1568,28 @@ def add_transformation(
1569
1568
for i in range (0 , 8 , 2 )
1570
1569
]
1571
1570
1572
- lowerleft = (min (new_x ), min (new_y ))
1573
- upperright = (max (new_x ), max (new_y ))
1574
-
1575
- self .mediabox .lower_left = lowerleft
1576
- self .mediabox .upper_right = upperright
1571
+ self .mediabox .lower_left = (min (new_x ), min (new_y ))
1572
+ self .mediabox .upper_right = (max (new_x ), max (new_y ))
1577
1573
1578
1574
def scale (self , sx : float , sy : float ) -> None :
1579
1575
"""
1580
1576
Scale a page by the given factors by applying a transformation matrix
1581
1577
to its content and updating the page size.
1582
1578
1583
- This updates the mediabox, the cropbox, and the contents
1584
- of the page.
1579
+ This updates the various page boundaries ( mediabox, cropbox, etc.)
1580
+ and the contents of the page.
1585
1581
1586
1582
Args:
1587
1583
sx: The scaling factor on horizontal axis.
1588
1584
sy: The scaling factor on vertical axis.
1589
1585
1590
1586
"""
1591
1587
self .add_transformation ((sx , 0 , 0 , sy , 0 , 0 ))
1588
+ self .mediabox = self .mediabox .scale (sx , sy )
1592
1589
self .cropbox = self .cropbox .scale (sx , sy )
1593
- self .artbox = self .artbox .scale (sx , sy )
1594
1590
self .bleedbox = self .bleedbox .scale (sx , sy )
1595
1591
self .trimbox = self .trimbox .scale (sx , sy )
1596
- self .mediabox = self .mediabox .scale (sx , sy )
1592
+ self .artbox = self .artbox .scale (sx , sy )
1597
1593
1598
1594
if PG .ANNOTS in self :
1599
1595
annotations = self [PG .ANNOTS ]
0 commit comments