Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    91
    Thanks
    19
    Thanked 0 Times in 0 Posts

    opening pdf with acrobat....

    Without <a href..>, I want to open pdf file with acrobat reader.

    I tried,
    PHP Code:
    echo "aaa.pdf"
    the msie shows error message.

    Any comment would be appreciated.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Maybe something like:
    PHP Code:
    <?php
    header
    ("Content-type: application/pdf");


    $file file_get_contents('aaa.pdf');
    echo 
    $file;
    ?>
    will work?

    Never used php to open a pdf before, but I'd think that the direct output with the content-type header will probably do the trick. Only one way to find out...

  • #3
    New Coder
    Join Date
    Jun 2005
    Posts
    91
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Dear Fou-Lu,

    Thanks a lot for your speedy and favorable comment.
    I will study and post result.


  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    no problem, let me know if it works, if not I'll try to throw something together for you.

  • #5
    New Coder
    Join Date
    Jun 2005
    Posts
    91
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Dear Fou-Lu

    I wrote ::
    PHP Code:
    <?php 
    header
    ("Content-type: application/pdf"); 


    $file file_get_contents('../pdf/2003.pdf'); 
    echo 
    $file
    ?>
    But the result is empty page.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Hmm, don't know what to tell you, this is what I used to test it with:
    PHP Code:
    header("Content-type: application/pdf");

    $file file_get_contents('./form.pdf');

    echo 
    $file
    the only real difference is my file location. So... I'm thinking the file path within your file_get_contents() is incorrect. Oh, of course this depends on your browser as well, some will display within your browser page (IE for example), some will prompt an application download.
    Under the assumption that your posting had been a complete script, just varify your file path is correct.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •