I've been stuck on this problem for a while, done lots of searches and tried various solutions that others reported to be working, and yet I'm still stuck. So any suggestion is hugely appreciated. Please let me know if I'm being unclear. Many thanks in advance!!
I'm trying to generate a PDF in Classic ASP (I know....) with FPDF v.1.01 (available from http://www.aspxnet.it/public/Default.asp?page=172). But I keep getting a message "File does not begin with '%PDF-'" when the PDF is populated. I've tried this in Firefox 7.0.1, IE9, which are the two browsers we use at work. If I remove this line from the code, then everything works as expected. So all I know is this line is the trouble maker (maybe?)
I have a file named report.asp. The organization of the files looks like this:
./rpt/report.asp ./rpt/fpdf.asp ./rpt/bg_logo_small.jpg ./rpt/fpdf/ - this directory contains all the files extracted from fpdf1.01.zip ./rpt/fpdf/extends/ ./rpt/fpdf/fonts/ ./rpt/fpdf/includes/ ./rpt/fpdf/models/
and report.asp looks like this,which is pretty much taken directly from the example on aspxnet.it site, except that I'm using my own jpg:
I've tried the same thing in VBScript with
and function Header() and function Footer() placed in bgimg.mod, which was saved in
The code above is all report.asp contains - no HTML inside.
I am not sure, if you haven't solved the problem yet, but anyway I answer, because it could help to somebody else.
I had the same problem and I was browsing and looking long long time for solution.
Finally I found the solution. Go in fpdf.asp file, look for line with code:
You can change the code e.g. like this:
where "Temp/" is name of folder where temporary file during PDF file generation will be created and later deleted. The main trick is to assign "Modify" access rights to the folder Temp.
The error "File does not begin with '%PDF-'" appear because there are no access rights to create and then delete temporary files for your final PDF file. So you have an option to assign "Modify" access right to your root folder or transfer temporary files for PDF in folder Temp and assign "Modify" only to folder Temp (this is more secure).