cesarvr / pdf-generator

Cordova plugin to generate pdf in the client-side
MIT License
107 stars 61 forks source link

IOS only showing images and HRs and not text #118

Open JustWoody opened 4 years ago

JustWoody commented 4 years ago

This is probably me, but this plugin was working brilliantly, showing the html and css that I was passing to it in the PDF

Then due to the impending cliff edge with Apple of removing UIWebView I made a load of changes to my project to remove any links to UIWebView and since then this plugin is no longer outputting any text that is in my local html

Not sure if this plugin is reliant on any framework or library that I have accidentally removed

Any help would be appreciated + sorry if this is not the location for this

I am getting this in the log if that helps: [Unknown process name] Failed to load /System/Library/PrivateFrameworks/CorePDF.framework/Versions/A/CorePDF

cesarvr commented 4 years ago

At the moment the plugin is using WKWebView, so it should work fine without legacy WebKit.

The library don't use any dependencies aside from WebKit, have you updated to the last version ? I removed some UIWebView dependencies.

JustWoody commented 4 years ago

Yes, as soon as I noticed the problem I removed and re-added the plugin

cesarvr commented 4 years ago

Also now that I see (again) the title of the issue, your problem could be also that the HTML you are providing doesn't include the text.

To test this try to print the payload your are passing to the plugin to the actual document.

You can try something like:

/*
 Assuming you are generating the payload with a bunch of HTML
*/

document.write(payload)
//The point here is to print the content into the browser to see your check if the text is appearing. 
//The plugin should display the same thing.
JustWoody commented 4 years ago

Already did that too and in the log everything is in the HTML string including the text (thank you for trying so far)

Just to say again that this was all working including the text until I needed to get rid of UIWebView from my project and that is why I am thinking this the plugin or underlying framework is relying on something that I accidentally removed, annoyingly for me I didn't spot this not outputting the text until some time later and I can't remember all steps I took - that is why I am wondering if there are any other frameworks or libraries that are outside the plugin itself that are required

JustWoody commented 4 years ago

Does it rely on coreGraphics as I removed that?

cesarvr commented 4 years ago

Nop, the only dependency is WebKit which the plugin use to render the PDF.

Already did that too and in the log everything is in the HTML string including the text (thank you for trying so far)

If I was you, I would try to render the PDF content in the browser (not print in a console), another way to test this is to copy paste the logs on a HTML file and open it in the browser.

I know it was working before, but is something you might consider because at the end this plugin is just a WYSIWYG with respect to the browser.

Cheers.

JustWoody commented 4 years ago

I already also output the HTML to the browser as this is to allow the user to save what appears on the screen

P.S. thanks for the suggestions