Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PDF Pane #1117

Closed
MarcSkovMadsen opened this issue Feb 23, 2020 · 0 comments
Closed

Add PDF Pane #1117

MarcSkovMadsen opened this issue Feb 23, 2020 · 0 comments
Labels
good first issue Good for newcomers type: feature A major new feature
Milestone

Comments

@MarcSkovMadsen
Copy link
Collaborator

My Pain

Once in a while I get a request to embed a pdf onto into a page. The use case is that someone might have written a pdf analysis, some documentation or a guide. And for the product owner its not enough to download and read this document. They wan't it to appear as a part of the application. And it enables some users to contribute to an app via Word and Pdf without knowing anything about html etc.

Solution

Add pn.pane.Pdf to panel that enables embedding pdf documents into a Panel app.

The pane should support pdf paths (str, pathlib.Path), urls (str) and files.

Additional Context

One way to solve this is to simply embed the pdf file as a base64 encoded url string

base64_pdf = base64.b64encode(pdf_file.read()).decode('utf-8')
pdf_display = f'<embed src="data:application/pdf;base64,{base64_pdf}" width="700" height="1000" type="application/pdf">' 

Another is to embed it as an iframe

<iframe id="fred" style="border:1px solid #666CCC" title="PDF in an i-Frame" src="PDFData.pdf" frameborder="1" scrolling="auto" height="1100" width="850" ></iframe>

See also https://stackoverflow.com/questions/19654577/html-embedded-pdf-iframe for a discussion.

I know that the user can just modify and use the code above in an pn.pane.Html but I think the pn.pane.Pdf would lower the friction of using Panel for some users.

@MarcSkovMadsen MarcSkovMadsen added good first issue Good for newcomers type: feature A major new feature labels Feb 23, 2020
@philippjfr philippjfr added this to the v0.12.0 milestone Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: feature A major new feature
Projects
None yet
Development

No branches or pull requests

2 participants