Integrate MuPDF Swift - IOS project

£可爱£侵袭症+ 提交于 2019-12-12 03:46:58

问题


After I created a Objective-c class in my project based on JosephH example. I imported it in my bridging header file. I was actually able to make it work using a .pdf file in the main bundle

NSString *file = [[NSBundle mainBundle] pathForResource:@"hello-world" ofType:@"pdf"];.

which returns:

"/var/containers/Bundle/Application/63F34E6B-75A7-4CC0-9149-9DF2861DF3A2/sempre-editora.app/hello-world.pdf"

It did render everything all right, zooming and everything. but when I try to render a file in my "Documents" folder it just doesn't work. I even tried to just put this "hello-world.pdf" file inside my "Documents" to try it out and it still doesn't work. This is the path of my documents file:

"/var/mobile/Containers/Data/Application/AF776E50-FAAC-4274-824F-4F9634E072F6/Documents/70-10"

What could be the problem? I'm sure this is the correct path for my file, and it actually exists, the framework doesn't throw any error but I just get a gray background.

I thought it could be because my file doesn't have an extension but when I add a .pdf to my file and try to render it, it crashes.

After some tests I realised that when the PDF has two pages, and I go to the second page, it actually renders the pdf.

来源:https://stackoverflow.com/questions/37703686/integrate-mupdf-swift-ios-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!