|PDFLib: Can't open a PDF file||#1|
Following are the PHP code lines which I am using to open a PDF file:
$pdf_generartor = new PDFlib();
$doc = $pdf_generartor -> open_pdi_document("Report.pdf", "") or die ("ERROR: " . $pdf_generartor -> get_errmsg());
Though the file is at required location, every time I receive following error:
ERROR: Couldn't open PDF file 'Report.pdf' for reading (file not found)
Is anyone familiar with the possible solution?
posted date: 2008-12-11 03:24:00
|Re: PDFLib: Can't open a PDF file||#3|
I think you've just got the file in the wrong place.Remember, if its linux, its case sensitive.And if your code is in included files etc, you need to bear that in mind when working out the path if you use it relatively.Try
It will output the path that PHP is translating Report.pdf to, and will likely help you work out why its going wrong.
posted date: 2008-12-11 03:31:00
|Re: PDFLib: Can't open a PDF file||#4|
This is not the case and I am using Windows. File is very much in the same directory as the source code file and there is a single code file containing all the code.
posted date: 2008-12-11 03:36:00
|Re: PDFLib: Can't open a PDF file||#5|
Thats my idea out the window then ..... ! I've not got experience with pdflib, always used FPDF.
posted date: 2008-12-11 03:39:00
|Re: PDFLib: Can't open a PDF file||#6|
Try to give a file from a different path, even mentioning the directory:
$doc = $pdf_generartor->open_pdi_document("D:\\Report.pdf", "") or die ("ERROR:")
posted date: 2008-12-21 20:51:00
|Re: PDFLib: Can't open a PDF file||#7|
I know it's a bit overdue, but I ran into this problem myself and managed to "fix" it. Apparently the PDF lib doesn't understand relative paths very well, so you'll have to use realpath().When you take a look at the samples, you can do this in two ways. You can either use realpath() with the actual file paths, or use realpath() with the "search directory".
$p = new PDFlib();$p->set_parameter("SearchPath", realpath("data/"));
$indoc = $p->open_pdi_document(realpath($infile), "");
posted date: 2010-09-08 05:54:00
|select page: « 1 »|