c# - iTextSharp doesn't work with PDF generated by Fax machine? -
i have class extract images pdf file, using itextsharp.
i tested pdf generated scan machine, worked fine.
then, tested pdf generated fax machine, got ioexception: .pdf not found file or resource.
i don't have clue why didn't work pdf fax machine. itextsharp not support pdf fax machine or something?
any thought appreciated. thanks
edit
public list<image> extractimagesfromfax(string sourcepdf) { var imglist = new list<image>(); try { var pdfreader = new pdfreader(sourcepdf); //error here ... (var = 0; <= pdfreader.xrefsize - 1; i++) { //code here } pdfreader.close(); } catch(exception ex) { console.writeline(ex.message); } return imglist; }
i tried read pdf itextsharp.text.pdf.pdfreader, got ioexception couldn't go further (only happened pdf generated fax machine).
pdf files:
the ioexception
says you're trying open file named ".pdf". 1 expect file named "somefile.pdf", have dot , extension pdf. sure name of file want read? sure code correct?
note exception isn't thrown itext class. pdfreader uses c# class trying open file, , it's c# class tells file can't found. can mean 2 things:
- you didn't use correct path.
- the application wrote doesn't have sufficient permissions access file.
you can check writing code reads file byte array without using itext. if fails, you've found problem.
Comments
Post a Comment