找不到PDF标题:找不到“%PDF” [英] failed to find PDF header: '%PDF' not found

查看:658
本文介绍了找不到PDF标题:找不到“%PDF”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从webservice端点下载pdf内容,它是以二进制的形式出现的。解码成base64后,我附加解码文件到webview,其中找不到pdf标题错误显示。

I am trying to download pdf content from webservice endpoint which is coming as binary. After decoding into base64 I am attaching the decoded file to webview, in which failed to find pdf header error is displaying.

有人知道如何继续解决这个错误?我在这里缺少任何步骤?

Does anyone know how can I proceed to fix this error? Am I missing any step here?

感谢。

推荐答案

添加类似

NSData *dataContent; // response data.
CFDataRef myPDFData;
myPDFData = (CFDataRef)dataContent;
CGDataProviderRef provider = CGDataProviderCreateWithCFData(myPDFData);

pdfDocument = CGPDFDocumentCreateWithProvider(provider);

CGDataProviderRelease(provider);

然后将pdfDocument加载到您的webview中。

Then load pdfDocument into your webview.

或看看制作自定义zoomPDFViewer。 Apple在 http://developer.apple上有一个很好的例子。 com / library / ios /#samplecode / ZoomingPDFViewer / Introduction / Intro.html 这是我做的,因为我无法获得PDF文档在网页视图中正确加载。

or have a look at making a custom zoomPDFViewer. Apple have a good example at http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html thats what I did as I couldn't get the pdfdocument to load correctly in a webview.

这篇关于找不到PDF标题:找不到“%PDF”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆