danfickle / danfickle/openhtmltopdf

images missing in created pdf?

Open
#928 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

im working on an app thats using this library. we have it set up to where a user sends an email from their phone and then our app will recieve it and make a pdf out of the entire contents of the body of the email. most email apps send images as attachments which is working perfectly in which a separate image file receipt will be generated for each attachment. but in the case of sending the email from iphone Mail app which always sends images as embedded in the body, the pdf result will have the text but the images are missing. QA says this feature used to work properly but i think like theyre either wrong or it used to work properly when they were using a different library.
heres some of the log:





Sent from my iPhoneimage0.png

FLAGS (\Seen \Deleted \Recent))
A7 OK FETCH completed.
PDFUtil - cHTD start
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1336)
at largesoft.receipts.pdf.PDFUtil.convertHtmlToDocument(PDFUtil.java:117)
at largesoft.receipts.html2pdf.DefaultHtml2PdfHandler.html2Pdf(DefaultHtml2PdfHandler.java:68)
at largesoft.receipts.DownloadEmail.handleBodyPart(DownloadEmail.java:947)
at largesoft.receipts.DownloadEmail.getAttachements(DownloadEmail.java:910)
at largesoft.receipts.DownloadEmail.doEMailDownload(DownloadEmail.java:650)
at largesoft.receipts.DownloadEmail.executeRequest(DownloadEmail.java:361)
at largesoft.receipts.ReceiptsAttachmentBkg.processReceipts(ReceiptsAttachmentBkg.java:43)
at largesoft.receipts.ReceiptsAttachmentBkg.freeWorkModel(ReceiptsAttachmentBkg.java:32)
at largesoft.bkgproc.ServerBackgroundProcess.run(ServerBackgroundProcess.java:446)
2023-05-19 03:39:42,237 [ReceiptsAttachmentBkg] ERROR server jsmith PDFUtil - Failed to load preferred font: NotoSansCJKsc-Light.otf
java.lang.NullPointerException: null
at largesoft.receipts.pdf.PDFUtil.getPreferredFont(PDFUtil.java:374) [extn-core.jar:?]
at largesoft.receipts.pdf.PDFUtil.convertHtmlToDocument(PDFUtil.java:130) [extn-core.jar:?]
at largesoft.receipts.html2pdf.DefaultHtml2PdfHandler.html2Pdf(DefaultHtml2PdfHandler.java:68) [extn-core.jar:?]
at largesoft.receipts.DownloadEmail.handleBodyPart(DownloadEmail.java:947) [extn-server.jar:?]
at largesoft.receipts.DownloadEmail.getAttachements(DownloadEmail.java:910) [extn-server.jar:?]
at largesoft.receipts.DownloadEmail.doEMailDownload(DownloadEmail.java:650) [extn-server.jar:?]
at largesoft.receipts.DownloadEmail.executeRequest(DownloadEmail.java:361) [extn-server.jar:?]
at largesoft.receipts.ReceiptsAttachmentBkg.processReceipts(ReceiptsAttachmentBkg.java:43) [extn-server.jar:?]
at largesoft.receipts.ReceiptsAttachmentBkg.freeWorkModel(ReceiptsAttachmentBkg.java:32) [extn-server.jar:?]
at largesoft.bkgproc.ServerBackgroundProcess.run(ServerBackgroundProcess.java:446) [extn-server.jar:?]
com.openhtmltopdf.load INFO:: TIME: parse stylesheets 73ms
com.openhtmltopdf.match INFO:: media = print
com.openhtmltopdf.match INFO:: Matcher created with 160 selectors
com.openhtmltopdf.load INFO:: Loading font(PREFERRED_FONT) from PDFont supplier now.
com.openhtmltopdf.exception WARNING:: Bad URL given: cid:B9631038-D3C7-4C0B-80D1-87003BAEE001-L0-001 => java.net.MalformedURLException:: unknown protocol: cid
com.openhtmltopdf.exception WARNING:: Bad URL given: cid:B9631038-D3C7-4C0B-80D1-87003BAEE001-L0-001 => java.net.MalformedURLException:: unknown protocol: cid
com.openhtmltopdf.exception WARNING:: Bad URL given: cid:B9631038-D3C7-4C0B-80D1-87003BAEE001-L0-001 => java.net.MalformedURLException:: unknown protocol: cid

Does the null pointer exception about the font have anything to do with this? Or does this "WARNING: Bad URL given" tell you anything important as to how I could possibly fix this?
I saw in another issue post someone said they got it working by adding a "temp folder" for the tomcat server, I checked with the team who say we already have a temp folder for the tomcat server.

Any help appreciated if theres nothing we can do then I will have to change to a different library.
Thank you.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.