I am trying to open Word and Excel 2003 docs using loadRequest and I am getting this error
(in simulator).
Unable to Read Document.
An error occurred while reading the document.
According to this link,
http://developer.apple.com/library/ios/#qa/qa2008/qa1630.html
UIWebView should display doc and xls types.
Any ideas?
Are there any other recommended xls, doc viewers out there?
Thanks.
The reason i found int these case was due to password protected or encrypted file,or any file format which webview can load.
UIWebView has these EXCEPTION SFUZipEndOfCentralDirectoryError: Could not find the end of central directory record when it encounter with above reason.
You can load document like this
Related
I have some code that reads pdf files. The code fails at the line :
iTextSharp.text.pdf.PRTokeniser.CheckPdfHeader() at
iTextSharp.text.pdf.PdfReader.ReadPdf()
I know from other entries that this issue is coming from some invalid formatting in the pdf. However I'm not in a position to tell my users to redo their pdfs. Is there some other way around this issue, that can allow reading of the pdf despite this problem?
If a file doesn't start with %PDF- then there's nothing to fix: the file isn't a PDF file.
However, there may be another problem: maybe you're trying to access a file that has zero length due to some problem while creating the InputStream. Another context in which I've seen this happen, is a PDF loaded from a server, where the server returned a 404 message in HTML instead of a PDF file ;-)
Whenever that exception happens, you should store the bytes somewhere, and examine them. Without those bytes, nobody will be able to give you useful advice.
what is the simplest way to check if a .pdf file is a valid pdf document using itext?
I have written some code to open a .pdf using the itextsharp.dll, and if i try to open a bad .pdf (one that I have edited in notepad++ to corrupt it) then i get a PDFInvalid exception - which is all good (as opposed to no exception if the pdf is valid).
However, I was wondering if there is another way to check for issues with pdf files.
I am about to extract a very large number of pdf documents from a database, and ideally would like to check that they are all valid pdf files - ie at least that they can be open.
Thanks for any replies in advance.
We are writing some program to display documents on iOS. I think that there are a lot of confusion on the web about what type of documents which iOS UIWebView could display. Generally people refer to Technical Q&A QA1630 Using UIWebView to display select document types to see that all the MS office 07+ files (such as docx, xlsx, pptx) could not be displayed, however actually that is not what we see from testing. Actually we are able to display docx/xlsx/pptx document at UIWebView either loading from a remote URL, local file or in memory (loadData, here the baseURL can not be nil on simulator, see this link). Of course We are testing on latest version of iOS on iPhone simulator, it might be that the support was not at older iOS. At this point, We don't know that yet. If you know, please let me know.
However right now, We have one issue to display document at UIWebView by using custom URL for security reason. I did the custom URL by following the code here: protecting iOS resource. We could display xls, doc, ppt, pdf file, but not docx/xlsx/pptx, We got some error like this:
EXCEPTION SFUZipEndOfCentralDirectoryError: Could not find the end of central directory record
We tried to debug and could not figure what's to do here. Do you see similar error here? Could anyone shed some lights on this? Thanks very much.
It looks like the document you're trying to open might be corrupt. docx, xlsx, and pptx files are actually zip files containing a bunch of XML documents and other data. Check if you are able to uncompress the file on your computer by renaming it to .zip and then unzipping.
I have some code that reads pdf files. The code fails at the line :
iTextSharp.text.pdf.PRTokeniser.CheckPdfHeader() at
iTextSharp.text.pdf.PdfReader.ReadPdf()
I know from other entries that this issue is coming from some invalid formatting in the pdf. However I'm not in a position to tell my users to redo their pdfs. Is there some other way around this issue, that can allow reading of the pdf despite this problem?
If a file doesn't start with %PDF- then there's nothing to fix: the file isn't a PDF file.
However, there may be another problem: maybe you're trying to access a file that has zero length due to some problem while creating the InputStream. Another context in which I've seen this happen, is a PDF loaded from a server, where the server returned a 404 message in HTML instead of a PDF file ;-)
Whenever that exception happens, you should store the bytes somewhere, and examine them. Without those bytes, nobody will be able to give you useful advice.
I want to load a word document using UIWebView. I used the code provided in
http://developer.apple.com/iphone/library/qa/qa2008/qa1630.html
to load the document.
But not all the documents load successfully. Sometimes I get an error
Error Domain=WebKitErrorDomain Code=102 UserInfo=0x145bc10 "Frame load interrupted"
The error seems to be very sporadic and I get this error only for some documents.
However the same document loads correctly in mail.app.
What am I missing?
The reason was, the file I tried to load doesn't contain a extension.
I was purposely removing the file extension (.doc and .ppt) which I think confused the UIWebView. Seems like iPhone ignores the OS 9 legacy typecodes completely. :)
I submitted a Radar regarding this issue. It's resolved in the latest version of iPhone OS 4.0.
http://openradar.appspot.com/radar?id=381401