I'm trying to generate a invoice PDF in my app. The idea is that invoice can be printed and than generate a PDF to send by email later.
All is working, including the print format, but when i export to PDF the logo image in PDF disappear.
This my original HTML in WKWebView
This is my printable version
But when i export to PDF it looks like this: The logo is missing.
My HTML is this:
<tr>
<td>
<table class="headerTable">
<tr>
<td width="33%"><img src="logo.png" style="width:80%; max-width:250px"></td>
<td width="1%"></td>
<td width="33%"><b>Realengo</b><br>Avenida Santa Cruz 1251<br>Realengo - Rio de Janeiro<br>Telefone: (21) 2401-0271</td>
<td width="33%"><b>Centro</b><br>Rua Buenos Aires 111<br>Centro - Rio de Janeiro<br>Telefone: (21) 2151-1189</td>
</tr>
</table>
</td>
</tr>
Does anyone figure out why my image is not in PDF?
WKWebView has supported export PDF in iOS14
import PDFKit
let config = WKPDFConfiguration()
webView.createPDF(configuration: config) { result in
switch result {
case .success(let data):
print("create pdf success: \(data)")
case .failure(let error):
print("create pdf failure: \(error)")
}
}
https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With