How can I download pdf file by clicking button ?

Comments

2 comments

  • Avatar
    Shirly Manor

    Hi,
    You can try do something like:


    <div
    onClick="window.location=pdf.php">something</div>

    pdf.php:

    <?php header('Content-disposition: attachment; filename=cl_image_tag("qpr2ddsqxyw0foujcttw.pdf"'); header('Content-type: application/pdf'); readfile('path/to/your_file.pdf');


    Or you can do something like:

    <a href="https://res.cloudinary.com/demo/image/upload/fl_attachment/multi_page_pdf_1.pdf">Test</a>

    0
    Comment actions Permalink
  • Avatar
    Michael Jonazh

    Thx Shirly, 

    Its solved, Thanks you for your help. 

    0
    Comment actions Permalink

Please sign in to leave a comment.