WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
214602
WKPDFConfiguration should have option to specify final PDF size
https://bugs.webkit.org/show_bug.cgi?id=214602
Summary
WKPDFConfiguration should have option to specify final PDF size
Brad Andalman
Reported
2020-07-21 11:04:37 PDT
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.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-07-21 18:42:43 PDT
<
rdar://problem/65914286
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug