0
我有麻煩使用fpdf和fdpi。FPDF/FDPI(當地工作,但不在線)
事實上,我想使用pdf模板並從提交的表單上顯示文本。
本地沒有問題,一切正常。
但是,當我貼我的服務器上的文件(我用1 & 1 WordPress的),我得到了以下錯誤
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Cannot open cerff.pdf !' in /homepages/19/d434684783/htdocs/wp-content/themes/Avada/pdf_parser.php:192 Stack trace: #0
/homepages/19/d434684783/htdocs/wpcontent/themes/Avada/fpdi_pdf_parser.php(71): pdf_parser->__construct('cerff.pdf')
#1 /homepages/19/d434684783/htdocs/wp-content/themes/Avada/fpdi.php(128): fpdi_pdf_parser->__construct('cerff.pdf')
#2 /homepages/19/d434684783/htdocs/wp-content/themes/Avada/fpdi.php(108): FPDI->_getPdfParser('cerff.pdf')
#3 /homepages/19/d434684783/htdocs/wp-content/themes/Avada/cerfa.php(8): FPDI->setSourceFile('cerff.pdf')
#4 /homepages/19/d434684783/htdocs/wp-includes/template-loader.php(74): include('/homepages/19/d...')
#5 /homepages/19/d434684783/htdocs/wp-blog-header.php(16): require_once('/homepages/19/d...')
#6 /homepages/19/d434684783/htdocs/index.php(17): require('/homepages/19/d...')
#7 {main} thrown in /homepages/19/d434684783/htdocs/wp-content/themes/Avada/pdf_parser.php on line 192
我真的不明白我能做些什麼來解決它。我的PHP代碼如下:
// Template Name: generationCerfa
include('fpdf.php');
include('fpdi.php');
// initiate FPDI
$pdf = new FPDI();
$pdf -> setSourceFile('cerff.pdf');
$tplIdx = $pdf -> importPage(1);
$size = $pdf->getTemplateSize($tplIdx);
$pdf -> AddPage();
$pdf ->useTemplate($tplIdx, 0,0,0,0, TRUE);
$pdf -> SetFont('Arial');
$pdf -> SetTextColor(0, 0, 0);
$pdf -> Output();
如果任何人都可以幫助我,那將是驚人的。感謝提前:)
我確切地說我已經在我的服務器根目錄上嘗試了相同的代碼,並且它在本地運行...所以我認爲這是一個wordpress問題,但是我無法得到什麼......:/ –