@@ -390,7 +390,6 @@ def do_apply_ocg(basepage, rmpage, i, uses_base_pdf, ocgprop, annotations):
390390 return ocgorderinner
391391
392392def invert_coords (point ) -> Tuple [float ]:
393- print (point )
394393 x = (point .x * PTPERPX )
395394 y = PDFHEIGHT - (point .y * PTPERPX )
396395 return (x , y )
@@ -410,7 +409,6 @@ def apply_annotations(rmpage, page_annot, ocgorderinner):
410409
411410 w = x2 - x1
412411 h = y1 - y2
413- print (a .quadpoints .points )
414412 qp = [c for p in map (invert_coords , a .quadpoints .points ) for c in p ]
415413
416414 pdf_a = PdfDict (Type = PdfName ('Annot' ),
@@ -505,6 +503,8 @@ def merge_pages(basepage, rmpage, changed_page, expand_pages):
505503 else :
506504 assert False , f"Unexpected rotation: { effective_rotation } "
507505
506+ annot_adjust = [0 , 0 ]
507+
508508 if bpage_ratio <= rpage_ratio :
509509 # These ratios < 1, so this indicates the basepage is more
510510 # narrow, and thus we need to extend the width. Extra space
@@ -521,6 +521,9 @@ def merge_pages(basepage, rmpage, changed_page, expand_pages):
521521 # Height and width are flipped for the basepage
522522 new_height = rpage_ratio * bpage_w
523523 scale = bpage_w / rpage_h
524+ # Not needed in the x-dim b/c extra space is added to the
525+ # right side, which doesn't impact alignment
526+ annot_adjust [1 ] = bpage_box [3 ] - new_height
524527 if effective_rotation == 90 :
525528 bpage_box [3 ] = new_height + bpage_box [1 ]
526529 else :
@@ -531,6 +534,7 @@ def merge_pages(basepage, rmpage, changed_page, expand_pages):
531534 if not flip_base_dims :
532535 new_height = 1 / rpage_ratio * bpage_w
533536 scale = bpage_w / rpage_w
537+ annot_adjust [1 ] = bpage_box [3 ] - new_height
534538 if effective_rotation == 0 :
535539 bpage_box [1 ] = bpage_box [3 ] - new_height
536540 else :
@@ -585,7 +589,6 @@ def merge_pages(basepage, rmpage, changed_page, expand_pages):
585589 qp = annot .QuadPoints
586590 rmpage .Annots [a ].QuadPoints = PdfArray (rotate_annot_points (qp ))
587591
588- annot_adjust = [0 , 0 ]
589592
590593 if '/Annots' in rmpage :
591594 for a , annot in enumerate (rmpage .Annots ):
0 commit comments