Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Pdf in Desktop application

Is there an easy way to display a (local) pdf within an titanium application?

I tried it via iframe providing the file path as file:///…
That did not work.

Any suggestions?

Cheers

Rob

— asked April 19th 2010 by Robert Schmidt
  • desktop
  • file
  • pdf
0 Comments

4 Answers

  • Accepted Answer

    I don't think there is a clear strategy in Titanium at the moment how it handles other MIME types than HTML. I had a discussion in the old forums about this topic. For me, sometimes PDFs get displayed via the Acrobat plugin, sometimes I see just the binary data of the PDF as plaintext.

    A reliable solution is to call the system's standard viewer via the Process API. Under Linux you can call 'xdg-open' and on OS X just 'open' and give the PDF as argument. This works well for me (I still have to figure out how to do it on Windows but I'm sure there is a system call as well)

    — answered April 20th 2010 by Stefan Washietl
    permalink
    0 Comments
  •             function openpdf(docpath){
                    var pdfprocess=Titanium.Process.createProcess({
                                args:['cmd','/C',docpath],
                            });
                            //alert("p");
                    pdfprocess.launch();
                }
    

    where docpath is something like "c:\dir name\dir\filename.pdf"

    — answered July 30th 2011 by Steve Hovey
    permalink
    0 Comments
  • Adding ‹embed src=“filename.pdf” width=“100%” height=“100%”› in the HTML works for me.

    Though I'm getting lots of "unlockFocus called too many time." errors in OSX now…

    — answered October 17th 2011 by Liam Fiddler
    permalink
    0 Comments
  • How about building a 3rd party PDF viewer with the help of some manual toolkits to help dispaly and read PDF files? I am not so sure about it. But I hope you success. Good luck.

    Best regrads,
    Arron

    — answered January 7th 2014 by arron lee
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.