I want to open pdf file in webview but the scenario is different here, I have saved pdf content as NSData into sqlite table (blob data type), I got success when I was inserting data into sqlite table but once I fetch the blob content into NSData and trying to open that data into WebView it gives me error – failed to find PDF header: `%PDF’ not found.
I am using webview’s loadData method to load data
[webView loadData:data MIMEType:@"application/pdf" textEncodingName:@"utf-8" baseURL:nil];
I did lots of search and also gone thru with other stack overflow questions but haven’t found sufficient answer.
thanks,
Mayur
The first four bytes of any PDF file are
%PDF. This is telling you that, by the time you are trying to display the data, it is not a PDF file (or if it is, the beginning has been chopped off).Either you are putting corrupt data into the SQLite database, or you are corrupting it when you get it out. It should be easy to confirm one way or the other by looking at the data in the database using the command line tools.