-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot force contentType in addPage #169
Comments
That's correct and there's not really a simple way to fix this. So you should make sure, that your HTML strings always contain a |
It's simple to fix this, permit to pass an override to the function. Here is a gist how I could do it easily (which could be easily backported to lib): |
I'm not sure, what you try to achieve. How is this related to the content type? Can't you simply set that in your HTML string? |
I'm building a middleware for rendering a webpage in pdf in a framework. I don't know what kind of html I will receive. Webkit can perfectly parse some HTML without the doctype or even the tag, I want to be able to have a pdf when those are absent without checking myself first. It's stupid to run twice the regexp when I already know what it's supposed to be. |
Ok, seems to make sense. I've added your suggestion to |
@Naouak I've just release 2.2.0 with your suggested changes. |
Thanks. Sorry I couldn't help you test it. On Thu, Jun 2, 2016 at 10:08 AM Michael Härtl [email protected]
|
Feedback is still welcome, so it would be great to let me know if the change now works for you. |
When using addPage, the system uses a regex to determine what type of content the input is. If your content is malformed but still valid for webkit, it will use the input as a filename instead of saving it to a file.
addPage needs a way to tell whether it' s a filename or content given.
Example :
Will try to render the file "
TEST
" instead of rendering HTML.The text was updated successfully, but these errors were encountered: