omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    PDF in sidebar

    Editorial
    2
    3
    2275
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mjakubowiak
      mjakubowiak last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        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')
        
        1 Reply Last reply Reply Quote 0
        • mjakubowiak
          mjakubowiak last edited by

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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors