UIPrintPageRenderer page-break bug when text is center aligned

Originator:simon
Number:rdar://42578949 Date Originated:25/07/2018
Status:Open Resolved:
Product:UIKit Product Version:iOS11 & 12
Classification:Bug Reproducible:Yes
 
Summary:
When rendering an HTML list into a PDF using UIPrintPageRenderer, page breaks work perfectly when the text is left aligned, however the page is cropped inside the page bounds when the text is center aligned.

I've tried various methods of layout for the list e.g. <table>, <div>, <ul>, and they all appear the same. The page break is still rendered in the PDF, however it is inside the 2nd page of the document because the first page has been cut short.

The same HTML printed to a PDF from Safari on macOS works fine.

Steps to Reproduce:
I've created a new project to demonstrate the issue. You can switch between the three different versions of the HTML, and for each of the three, you can switch between center and left aligned text. It will then show the print preview of the generated PDF to demonstrate the problem.

Expected Results:
Whether the text is aligned left or center, the page break should render at the end of the page.

Actual Results:
When the text is center aligned, the page break is rendered in the middle of the second page.

Version/Build:
Xcode 9.4.1
Tested on both iOS11 and iOS12 devices and simulators. Results the same on all.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!