@qutescheme.add_handler('pdfjs', backend=usertypes.Backend.QtWebKit)
def qute_pdfjs(url):
 try:
  data = pdfjs.get_pdfjs_res(url.path())
 except pdfjs.PDFJSNotFound as e:
  log.misc.warning('pdfjs resource requested but not found: {}'.format(e.path))
  raise qutescheme.QuteSchemeError("Can't find pdfjs resource '{}'".format(e.path), QNetworkReply.ContentNotFoundError)
 else:
  (mimetype, _encoding) = mimetypes.guess_type(url.fileName())
  assert (mimetype is not None), url
  return (mimetype, data)

@ qutescheme . add_handler ( 'pdfjs' , backend = usertypes . Backend . QtWebKit ) def qute_pdfjs ( url ) : try : data = pdfjs . get_pdfjs_res ( url . path ( ) ) except pdfjs . PDFJSNotFound as e : log . misc . warning ( 'pdfjs resource requested but not found: {}' . format ( e . path ) ) raise qutescheme . QuteSchemeError ( "Can't find pdfjs resource '{}'" . format ( e . path ) , QNetworkReply . ContentNotFoundError ) else : ( mimetype , _encoding ) = mimetypes . guess_type ( url . fileName ( ) ) assert ( mimetype is not None ) , url return ( mimetype , data )
handler for qute://pdfjs .