fpdi


FPDI Fatal error: Uncaught exception 'Exception' with message 'Unable to find object (1, 0)


I'm trying to import a pdf with php class FPDI with this simple code:
require_once("fpdf/fpdf.php");
require_once("fpdi/fpdi.php");
$pdf = new FPDI();
$pdf->setSourceFile('intermedia.pdf');
$tplidx = $pdf->ImportPage(1);
$pdf->AddPage();
$pdf->useTemplate($tplidx,0,0,210);
$pdf->Output();
but I receive the following error:
Warning: explode() [function.explode]: Empty delimiter. in
/var/catalogo/test_pdf/fpdi/pdf_parser.php on line 369
Fatal error: Uncaught exception 'Exception' with message 'Unable to
find object (1, 0) at expected location.' in
/var/catalogo/test_pdf/fpdi/pdf_parser.php:709 Stack trace: #0
/var/catalogo/test_pdf/fpdi/pdf_parser.php(268):
pdf_parser->resolveObject(Array) #1
/var/catalogo/test_pdf/fpdi/pdf_parser.php(208):
pdf_parser->_readRoot() #2
/var/catalogo/test_pdf/fpdi/fpdi_pdf_parser.php(71):
pdf_parser->__construct('/var/catalogo/t...') #3
/var/catalogo/test_pdf/fpdi/fpdi.php(128):
fpdi_pdf_parser->__construct('/var/catalogo/t...') #4
/var/catalogo/test_pdf/fpdi/fpdi.php(108):
FPDI->_getPdfParser('/var/catalogo/t...') #5
/var/catalogo/test_pdf/index.php(5):
FPDI->setSourceFile('intermedia.pdf') #6 {main} thrown in
/var/catalogo/test_pdf/fpdi/pdf_parser.php on line 709
This is the file that should be imported:
http://catalogo.selectaspa.it/test_pdf/intermedia.pdf
Ok, the cross reference of this file is simply corrupted. I just catched the "Warning" on explode for now but at the end you will have to resave the document with e.g. Acrobat to repair it before passing it to FPDI.
You may change pdf_parser.php around line 362 to:
// get Line-Ending
$found = preg_match_all("/(\r\n|\n|\r)/", substr($data, 0, 100), $m); // check the first 100 bytes for line breaks
if ($found === 0) {
throw new Exception('Xref table seems to be corrupted.');
}
Same fix can be used in the separate FPDI PDF-Parser which will allow you to read this document then, too.

Related Links

FPDI Fatal error: Uncaught exception 'Exception' with message 'Unable to find object (1, 0)

Categories

HOME
merge
jmeter
powerpoint
yandex
xbee
aws-cli
telegram-bot
spring-session
android-json
gluon-mobile
frontend
okhttp
little-proxy
categorical-data
dkim
enthought
windows-ce
line
tput
bitnami
internationalization
html5-appcache
connector
replication
poedit
babel
object-storage
short-url
inversion-of-control
boost-asio
userdefaults
mustache
turfjs
hibernate-validator
installshield-le
activexobject
arduino-ide
apic
zoomify
jpad
sessionstorage
nohup
escpos
photos
plan-9
sonarlint-eclipse
yii2-api
fclose
payara-micro
qtranslate
tinkerpop
libjpeg
monkey
cronexpression
chromium-os
usart
pure-css
builtins
redistributable
i386
cifilter
riot
upx
yajsw
lz77
directdraw
sapi
dynatree
file-move
intel-c++
binomial-theorem
airbrake
grouping-sets
variadic-templates
ssis-data-flow
crowd
administration
linkedin-jsapi
human-computer-interface
verold
winginx
spring-3
scriptaculous
mysql-error-1044
embedded-fonts
kogrid
scringo
flex++
video-codecs
preload
idn
os.system
faye
failing-tests
floating-point-exceptions
jqote
multiplatform
xui
web-garden
pagemethods
escrow
localizable.strings
application-planning

Resources

Encrypt Message