Forum Archive

PDF in sidebar

mjakubowiak

I am trying to create a workflow, based on PDF in Browser to show a selected PDF file in a sidebar. When in the webview object's options in the UI section I hardcode an URL of a file (generated by PDF in Browser) - it works. But when I use load_url with the same address, I just get a blank page.

This is the code I use:

v = ui.load_view() v['webview1'].load_url('file:///var/mobile/Applications/…/Library/Application%20Support/Dropbox/….pdf') v.present('sidebar')

What am I doing wrong?

Thanks for your help!

omz

Unfortunately, there's a really stupid bug in WebView.load_url (and also WebView.load_html) that converts any string you pass to it to lowercase. I have no idea how that happened, and I'll try to get a bugfix update out as soon as possible.

In the meantime, you can use a workaround like this:

v['webview1'].load_html('')
import time
time.sleep(0.2)
v['webview1'].eval_js('window.location.href = "file:///var/mobile/Applications/…/Library/Application%20Support/Dropbox/….pdf"')
v.present('sidebar')
mjakubowiak

That is what we may call an instant support! Thanks a lot!