Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > file does not begin with '%PDF-' - Error when searching pdfs on FireFox browser

Reply
Thread Tools

file does not begin with '%PDF-' - Error when searching pdfs on FireFox browser

 
 
lvb
Guest
Posts: n/a
 
      08-02-2006
Hello all:

I have monthly PDFs that I store in a directory and display the 2
latest ones, the rest user can search them by date (mm-yyyy). Now I
have 2 questions:

First, which one is a better solution, store in a directory or in a
database and retrieve? It just started so we only have a few PDFs now.
What happens if latter we add more and more PDFs?

Second, and it's the problem, the PDFs are just fine, I can open them
directly on any browser. However when I search & open it, it throws an
error " file does not begin with '%PDF-' " on Firefox and on some IE
browser (my laptop's IE gives the same error.). I've done some
research, Adobe gives solution
http://www.adobe.com/support/techdocs/319294.html
But it doesn't satisfy me. Does anyone know what happens here? Could
it be my script's problem? Please see the script below:

if (defined $ins{newsletter_text}) {

my $letter = "$ins{newsletter_text}.pdf";

$path_dir = "/www/html/newsletter/";
opendir(DIRhandle, $path_dir) || die("Cannot open directory");
@thefiles= readdir(DIRhandle);
closedir(DIRhandle);

foreach $file (sort @thefiles) {

unless ( ($file eq ".") || ($file eq "..") ) {
if ($file eq $ins{newsletter_text}) {
print "location:/newsletter/$ins{newsletter_text}\n\n";
last;
}
elsif ($file =~ /\Q$ins{newsletter_text}\E/i) {
if ($ins{newsletter_text} =~ m/^\d\d-\d\d\d\d$/) {
print "location:/newsletter/$letter\n\n";
} else {
print "location:/cgi-bin/outdoor.cgi?pg=gov&err=1\n\n";
}
}
}
}

Also I realized that when I open the PDF from a link, in the Address
Bar, it shows the path something like '/gl/newsletter/06-2006.pdf'
but when I open it from the search form, it show the path somethink
like '/cgi-bin/gl/newsletter.cgi'

newsletter.cgi proccess the search and redirect to the PDF. Could it
be that Firefox considers it as a cgi file?

Any ideas, please?

Thanks much in advance.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with Indexing Service Not Showing PDFs in Results =?Utf-8?B?cmF6b3I=?= Windows 64bit 1 09-06-2007 02:20 AM
"Member not found" error when opening PDFs in new window johkar Javascript 2 11-02-2006 10:05 PM
file does not begin with %PDF - BinaryWrite TrailBlazer ASP General 0 02-27-2006 05:06 PM
Problem when searching for PDFs with Indexing Service in ASP-solution. Martin Emanuelsson ASP General 7 10-18-2004 03:50 PM
PDFs in Acrobat Reader 6.0 with IE 6.0 over Tomcat with Content-Disposition inline can not be displayed siarsky Java 1 02-10-2004 05:31 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57