Replies: 2 comments 1 reply
-
url not to open file like pdf from flet import *
import os
def main(page: Page):
# [+] To Open PDF from Defult App set to open pdf file
def open_pdf_from_defult_app(e):
file = r'file_path' # set pdf file path
os.startfile(file)
# [+] To Open PDF from Chrome
def open_pdf_chrome(e):
file = r'file_path' # set pdf file path
cmd = f'start chrome {file}' # Cmd command to open Chrome
os.popen(cmd)
container_1= Container(width=500, height=500, border=border.all(2), border_radius=10,
on_click=open_pdf_from_defult_app,
content=Column([
Text('Open pdf file from Defult App You Set To Open Pdf File'),
Text('Click Here')
]))
container_2 = Container(width=500, height=500, border=border.all(2), border_radius=10,
on_click=open_pdf_chrome,
content=Column([
Text('Open pdf file from Chrome only'),
Text('Click Here')
]))
page.add(Row([container_1, container_2]))
if __name__ == '__main__':
app(main, view=WEB_BROWSER, port=5880) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks for feedback, unfortunately it's not for local usage it's for a client server app. I meanwhile use my webserver to provide the required pdfs so I can access the files via http://xxxx/yyyy.pdf. This is working. But anyway if there is any way to access directly via file://xxxxx/yyyy/test.pdf would be good to know... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Hello,
I tried to open a file link (local network share) via Container url and url_target. When setting e.g. www.google.de to url everything works as expected unfortunately for file urls this seems not to work. E.g. file://xxxxx/yyyy/test.pdf. In the browser itself the file link is working but not from flet. Maybe anyone experienced the same or there is a workaround for this. I am working on a Web App on Windows.
Thanks
Code sample
No response
Error message
No response
------------------------------------------------------
Beta Was this translation helpful? Give feedback.
All reactions