CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Printing eps file from perl


New User

Jan 23, 2012, 7:20 AM

Post #1 of 1 (5247 views)
Printing eps file from perl Can't Post

I'm building a system that gives authorized users access to protected documents. These documents are served through the perl script upon request. This script requires a valid login before serving such documents.

This script works fine for all of my binary files except for one: .eps files. Once the file is downloaded from a browser, graphic editing programs, such as photoshop, returning parsing errors. However, if I have the same script simply dump the data to a file on the server and then FTP the file to my computer, it works just fine. Obviously, there is an issue related to Apache's handling of the .eps data that is different than the other binary files.

Here is a simplified version of the script:

#!/usr/bin/perl -w
use strict;
my $dir = "/home/sitedirectory/document_repository/";
my $file = "company_logo.eps";
my $mimetype = "application/postscript";
binmode(FILE, ':raw');
my $output;
my $buffer;
while (read(FILE,$buffer,1024)) {
$output .= $buffer;
my $length = length($output);
print qq{Content-Disposition:attachment; filename="$file"\n\n};
print "Content-type: $mimetype\n\n";
print qq{Content-Length: $length\n\n};
print $output;

Any help on this would be greatly appreciated.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives