Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 18
Registered: ‎06-27-2014
My Device: Z10
My Carrier: Vodafone

Invoking PDF from Webview

Hi,

 

the last obstacle to finish my app is taching it to open a pdf from a webview. I tried several solutions I found in the forum but nothing seems to work. To deal with just one problem at a time I copied the pdf-File "test.pdf" in my assets folder. Here is the code I used so far:

 

attachedObjects: [
   Invocation {
      id: pdf
      query: InvokeQuery {
         mimeType: "application/pdf"
         uri: "asset:///test.pdf"
         invokeActionId: "bb.action.OPEN" 
      }
   }
]

[...]
pdf.trigger("bb.action.OPEN");

 

And here is the error message I get in the console

---

InvocationPrivate::setQuery: you are not allowed to change InvokeQuery object
NavigationPane: NavigationPaneOnFwdTransitionDone: emitting push transition ended for page: 12 client top: 12
PpsTimeSettingsObject::newSettingsData() emitted
InvocationWrapper:Smiley SurprisednQueryFinished: no matching result from Menu Service for query
mimeType="application/pdf"
uri=QUrl("asset:///test.pdf")
data= ""
metadata= QMap()
perimeter= 0
action= "bb.action.OPEN"
target= ""
invokerIncluded= false
InvocationPrivate:Smiley SurprisednQueryResolved: no result matching query, no armed signal sent.

---

 

I think the first line is the problem, but I don't know what it means. I tried a similar solution for opening .ics files with the calendar but with no better results.

 

 

Apart from this, my orignial intention was to open an url like "http://web.site.com/test.pdf". Will this work as well (if it works at all) or do I have to download and save the file first? If yes - what is the best way for this? 

 

 

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Invoking PDF from Webview

You need to use a file:/// URI, not asset:///.  You can see the invocation formats accepted for PDFs here:

 

Adobe Reader - Opening a .pdf file

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker