is it possible? In Unity i mean… the company i’m working for could really use it, and we are willing to pay someone to program a pdf reader for us…
Not sure you have a purpose to read a PDF in Unity… Just google up PDF API’s, if you find one that is a managed library, it will probably work, but what you want will be some way to convert the PDF to a PNG or JPEG so maybe look up PDF to JPEG or PNG converters, see if anyone has written one.
Pretty much everything is possible, but it would be highly non-trivial.
–Eric
Hmm actually what we need is a pdf reader with text search functionality, so no conversion to images for the moment… Right now we’re thinking to integrate the unity app inside a native app (it’s ugly but it could work), and since we need to pay someone to do that it would be better to have everything integrated in Unity…
It’s not a game btw…
Anyone interested? ![]()
Sounds Interesting but unfortunately i do not have the expertise for this job but getting the pdf file would be easy but loading it inside unity is the problem. Can you give us any more details, like is it going to be loading multiple pdf files, but you could embedded a flash swf and that could handle the pdf files. Good Luck
Displaying the information is one thing, to have the search features that are in the PDF is something totally different. Unity in a native app is simple enough to just publish as a web browser app and use the web interface in C# for instance. But to further try to show the PDF in Unity with search abilities in native PDF format, that link from Sicarius won’t get you very far. One source to begin this research would be to look at DjVuLibre, http://djvu.sourceforge.net
There is another open source technique from Samurajdata at http://view.samurajdata.se
Finally there is a java renderer for PDF’s that is open source to get to see how they did it: http://www.icepdf.org
Any of those sets of code should get you started along the path you are looking, but search features? Trickier
Ops i forgot to mention that by native i mean iOs, as we’re developing for iPad… (please don’t kill me xD) so flash is not an option
but yes, it needs to be able to load multiple pdfs (around 100) and navigate through them, like a catalog.
Thank you i’ll look into those; we may choose to discard the search functionality and go for a “chapters” navigation, but it all depends on the client’s requests…
I have very little experience with Objective-C and iOs functionalities, but is PDF reading a built-in feature or at least easier to achieve? If yes then we could enable the reader from inside Unity…
You put in a new level of difficulty when you mentioned iPad/iPhone app, now, there are already PDF readers available for download with cataloging features, how they did this I have no idea. If you are looking to make a virtual cataloger for iPad/iPhone like the eBook readers, your best bet would be to do something Object-C Native, avoid Unity’s overhead since you are trying to make a 3d version of the reader system. I am not saying it is impossible, but would probably require iPhone Pro version (which assuming you have it already), and a very strong familiarity of Object-C, personally, I think you are going overboard by using Unity and creating a PDF reader / cataloger. That is just IMHO though, it is a very challenging project, probably doable, not sure how, but anything is possible like Eric says.
dragging up old thread… anyone every get any progress on this on iOS ? I’m looking into the same issue… view and interact with pdf contents, not just display it
Me too.
I’m looking for a simple solution to display a PDF using the iOS native PDF viewer. On Windows i can open a fullscreen PDF reader to display the PDF, on iPad i’d like to use the default PDF viewer. Is there any alternative to uWebKit for doing this? When i use Application.OpenURL it opens Safari …
in here i didn’t find any pdf viewers. but just google it. you can find plenty of PDF viewers.
The OS X “Cocoa”, and iOS “Cocoa Touch”, APIs both have built-in PDF support as standard. (The OS X GUI is actually built on PDF technology, so the PDF features are effectively ‘free’.)
The trick is finding a way to nail a Cocoa-built PDF viewer component onto your Unity project. Assuming you have suitable Unity Pro licenses, you can modify the default Xcode template(s) to add the PDF component. The only problem here is that you effectively have to jump back and forth between the Unity part to the PDF viewer part, which requires a good understanding of iOS, Cocoa Touch, and Objective-C programming.
It’s not exactly trivial, but it is possible.
An alternative would be to build a proper C++ plugin that exposes iOS’ PDF rendering features directly to Unity scripts. Much depends on your budget, UI design, and technical requirements.
For ios you can render an pdf in a native plug-in and write it into a texture that unity is using.
That did the trick for me.
http://stackoverflow.com/questions/9903864/render-coregraphics-to-opengl-texture-on-ios
Not sure how to port this to OSX.
Me too
PDFReader AssetStore iOS plugin
Hi did you have any Unity specific code you could share as I am also interested in reading a PDF directly to a texture.
On the unity side of things there is not much to do.
[DllImport ("__Internal")]
private static extern void NativeFunctionName(int textureId);
public Texture2D myTex;
// Use this for initialization
void Start () {
int myTexId = myTex.GetNativeTextureID();
NativeFunctionName(myTexId);
}
The rest is the difficult part of rendering the PDF into the opengl texture with the provided id.
You do not not need to return anything , because you just overwrite the texture in the native code.
Thank you a lot, the code works perfect for me.
HI
Does this plugin allow me to create a pdf document on an android device and have access to it after?
I need to be able to create a pdf document from some records and then add it to a email as a attachment.
Thanks