-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2cf879
commit 0cf8daf
Showing
5 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from pathlib import Path | ||
import dash_html_components as html | ||
from ..webviz_assets import webviz_assets | ||
|
||
|
||
class EmbedPdf: | ||
'''### Embed PDF file | ||
This container embeds a given PDF file into the page. | ||
* `pdf_file`: Path to the PDF file to include. Either absolute path or | ||
relative to the configuration file. | ||
* `height`: Height of the PDF object (in percent of viewport height). | ||
* `width`: Width of the PDF object (in percent of available space). | ||
_Note_: Webviz does not scan your PDF for malicious code. | ||
Make sure it comes from a trusted source. | ||
''' | ||
|
||
def __init__(self, pdf_file: Path, height: int = 80, width: int = 100): | ||
self.pdf_url = webviz_assets.add(pdf_file) | ||
self.height = height | ||
self.width = width | ||
|
||
@property | ||
def layout(self): | ||
|
||
style = { | ||
'height': f'{self.height}vh', | ||
'width': f'{self.width}%' | ||
} | ||
|
||
return html.Embed(src=self.pdf_url, | ||
style=style, | ||
type='application/pdf') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters