in reply to Re: displaying pdf
in thread displaying pdf

This code almost works. The browser kickstarts a download when the page is loaded and asks for a acrobat or a file save.

If I select Acrobat a warning about a damaged file comes up and is being repaired. A blank pdf file is displayed.

I will work it some more or some one can spot my error.

#!perl -w $| = 1; print "Content-Type: application/pdf\n\n"; open(FILE,"dental.pdf") or die("$!"); binmode(FILE); while (sysread(FILE,$buffer,1024)) { print STDOUT $buffer; }

Disclaimer

Replies are listed 'Best First'.
Re: Re: Re: displaying pdf
by Thelonius (Priest) on Oct 21, 2002 at 20:37 UTC
    Try binmode STDOUT;
      It works.
      #!perl -w $| = 1; open(FILE,"dental.pdf") or die("$!"); print "Content-Type: application/pdf\n\n"; binmode(FILE); binmode(STDOUT); while (read(FILE,$buffer,64000)) { print STDOUT $buffer; }
      Disclaimer