[Webkit-unassigned] [Bug 214602] New: WKPDFConfiguration should have option to specify final PDF size

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 21 11:04:37 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=214602

            Bug ID: 214602
           Summary: WKPDFConfiguration should have option to specify final
                    PDF size
           Product: WebKit
           Version: Other
          Hardware: Macintosh
                OS: macOS 10.15
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit API
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: bya at 180g.co

Currently, the createPDF() method on WKWebView uses the rect in WKPDFConfiguration and a dpi of 72 to create the final PDF. That means that there is no way to change the size of the final PDF – you get what you get based on the rect.

It would be great if that were configurable. The current "rect" property is really the source rect, so perhaps a "destRect" property on WKPDFConfiguration could be considered. Another way to think of this is a scale on the rect, or even just a configurable dpi (if the destRect/scale options are too general).

The motivation: we are trying to use WKWebViews in our application, instead of the legacy WebViews. Our app, though, needs to generate PDFs of an exact size (for publishing). We also want to show a preview of the PDF to our users – but the size that we need for the PDF would be too small for our users. 

For this reason (and others), we use a rect that is twice as big as the dimensions of the final PDF. With the old WebViews, we can use CGContextScaleCTM in between CGPDFContext{Begin,End}Page calls, and our final PDF will have the correct, halved, size. Unfortunately, there is no great way to do this with the current API on WKWebView.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200721/4b3538e6/attachment.htm>


More information about the webkit-unassigned mailing list