Giter Site home page Giter Site logo

Comments (5)

zenato avatar zenato commented on September 13, 2024

@nkuehn Thanks for your issue report.

I tested shell with curl command.

curl -o test.pdf http://localhost:3000/\?url\=google.co.kr\&type\=pdf

It works.

And it worked well on the Chrome browser.

In addition, I added content-length into response header

from puppeteer-renderer.

nkuehn avatar nkuehn commented on September 13, 2024

wow, that was fast. Looks like I primarily forgot to properly encode the URL.

but the content-length seems to have an issue in Firefox - curl finishes fine, but when I enter "http://localhost:3000/?url=google.co.kr&type=pdf" in chrome the download is stuck at "128kb of 135kb". The file curl wrote has 137954 bytes which is the "135kb" Firefox is showing.

If I look into the downloads folder the .part file Firefox writes into is already there completely and has the full 135kb that contain a valid PDF I can open. But it's just not completing the process.

Chrome and Safari both happily display the PDF, but not Firefox. Can't really tell why though. I don't think it requires a Content-Disposition header (that would just help being able to control the filename that is saved on disk as far as I know).

Here's somebody with a similarly sounding problem but no real learning: https://stackoverflow.com/questions/34684919/how-do-i-get-firefox-to-complete-a-download-sent-from-restify-nodejs

from puppeteer-renderer.

zenato avatar zenato commented on September 13, 2024

I tested again via curl, chrome, firefox.
It worked well.

.part file was not created in download directory, and file size was the same as the size specified in the header.
So it seems to be firefox browser issue.

Thanks for your comment.

from puppeteer-renderer.

nkuehn avatar nkuehn commented on September 13, 2024

thanks for testing again - I'll dig into what could be the difference on my machine myself then.

from puppeteer-renderer.

nkuehn avatar nkuehn commented on September 13, 2024

PS: I got firefox to behave reliable by setting the content-disposition header to make it a download and set the PDF filename. It has an effect on chrome, too - will download then instead of directly showing the PDF. I'll send a PR in case you're interested in changing to that behavior

from puppeteer-renderer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.