Git Product home page Git Product logo

Comments (6)

spiritix avatar spiritix commented on June 22, 2024

If you're using the download output class, it's already implemented like you suggested: https://github.com/spiritix/php-chrome-html2pdf/blob/master/src/Spiritix/Html2Pdf/Output/DownloadOutput.php#L52

from php-chrome-html2pdf.

coxfrederic avatar coxfrederic commented on June 22, 2024

Yes I am aware of that but the problem is, when using that one, the file is downloaded automatically.
We want it to display inline, but when the user wants to download it, it gets downloaded as a PDF.

from php-chrome-html2pdf.

coxfrederic avatar coxfrederic commented on June 22, 2024

Now when the user wants to download it the Chrome browser says it's downloading index.php instead of the PDF

from php-chrome-html2pdf.

spiritix avatar spiritix commented on June 22, 2024

Okay I see. The issue is that the RFC states:

If the disposition type matches "attachment" (case-insensitively), this indicates that the recipient should prompt the user to save the response locally

I don't see a way to use 'attachment' and still embed the file in the browser. Do you have an idea how to do that?

from php-chrome-html2pdf.

coxfrederic avatar coxfrederic commented on June 22, 2024

I think we need to look for a way to be able to use "inline" and somehow get the filename download to work correctly.
The strange thing is we get different results on Chrome on different environments (server vs locally on vagrant) and wether it is the result of a POST request vs a call without using POST.

I'll investigate more and when I have some clear results we can check the solution

from php-chrome-html2pdf.

spiritix avatar spiritix commented on June 22, 2024

I think the browser automatically uses the file name as in the URL. So in case of www.example.com/pdf.php it will be pdf.php. You could use rewrite rules to redirect a filename like /MyFile.pdf?id=1000 to /pdf.php?id=1000, that should work.

Leaving this issue open in case anybody has an idea on how to solve this in the backend.

from php-chrome-html2pdf.

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.