6

How can I integrate the mupdf library into an existing iOS project? I can run the provided source on my device and simulator, but I can't seem to manage to add it to my project correctly. I tried linking and importing the compiled static libraries but it only works in the simulator, even if I use lipo to build a fat library with all the architectures (armv7 armv7s arm64 i386). In this case the error is

file was built for archive which is not the architecture being linked (armv7s)

Ideally i would like to have it added as a submodule for ease of upgrading, I tried that too, but i can't get xcode to recognize where the built libraries are.

Cesare
  • 9,139
  • 16
  • 78
  • 130
sPoz
  • 153
  • 1
  • 8
  • Is it necessary to use MuPDF? Note iOS has its own PDF libraries. – Sulthan Feb 18 '14 at 16:41
  • I know, there are some integrated ways (UIWebView, Tiled view), but they're not as efficient. There are other libraries, but they're extremely pricy. – sPoz Feb 18 '14 at 16:44
  • iOS contains a very specific framework to read/render/create PDF files. Search `CGPDFDocument`. – Sulthan Feb 18 '14 at 17:21
  • I'm aware of that and looked into it before diving into MuPDF, but i need some of the features it provides. Namely form filling and annotations support. – sPoz Feb 19 '14 at 08:27
  • Have you find a way to do that ? I have the same problem. I can build and run the demo project but can't build it by my self. – Bagusflyer Mar 15 '14 at 11:49

2 Answers2

3

I was able to generate and integrate the MuPDF library for all architectures. I wrote a small step-by-step tutorial on this post.

I hope it will help you ! Cheers

Community
  • 1
  • 1
Kevin Delord
  • 2,498
  • 24
  • 22
3

The easiest way is probably to use the MuPDF CocoaPod. There is an example application based on that pod.

JosephH
  • 37,173
  • 19
  • 130
  • 154
  • @HenriquedaCosta I haven't do so, yet. I think it won't work currently, for a couple of reasons that could be solved with some development effort. Are you one of Artifex's commercial customers? If so I'd ask them directly. – JosephH Jun 08 '16 at 12:04
  • I'm not actually. I made it work using your example and creating a bridge header for my project. I can make it work with a document in the MainBundle but I just can't make it work with files i download. Any thought on that? ty anyway. – Henrique da Costa Jun 08 '16 at 12:16
  • @HenriquedaCosta Great! It should work fine, you just need to pass the full path of the document in the right place. If you can't make it work it's probably best to start a new question with details of all the paths and the relevant code fragments. (Be aware that, as you don't have a commercial license, you will need to comply with the AGPL if you plan to distribute an app that contains mupdf!) – JosephH Jun 08 '16 at 12:28
  • i've created a new question for that case. Let me know if you can help at all. Thanks. http://stackoverflow.com/questions/37703686/integrate-mupdf-swift-ios-project – Henrique da Costa Jun 08 '16 at 13:19