Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat(resource): add document viewer with download (DSP-1791) (#485)
* chore(deps): add ng2-pdf-viewer * chore(deps): bump dsp-js version * chore(deps): add ng2-pdf-viewer * refactor(resource): better file representation handling * refactor(resource): update still image viewer same view as for documents * feat(resource): document viewer * feat(resource): document viewer * style(resource): same style in document and still image viewer * test(resource): fix tests * style(resource): bigger representation viewer
- Loading branch information
1 parent
e12f196
commit ce51bce
Showing
19 changed files
with
896 additions
and
1,294 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
39 changes: 39 additions & 0 deletions
39
src/app/workspace/resource/representation/document/document.component.html
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,39 @@ | ||
<div class="pdf-container"> | ||
<div class="action horizontal top overlay"> | ||
<!-- caption --> | ||
<span class="caption mat-caption"> | ||
<input | ||
#queryInp | ||
type="text" | ||
id="searchbox" | ||
name="searchbox" | ||
class="pdf-searchbox" | ||
placeholder="Search in pdf..." | ||
[value]="pdfQuery" | ||
(input)="searchQueryChanged($event.target.value)" | ||
(keyup.enter)="searchQueryChanged(queryInp.value)" | ||
/> | ||
</span> | ||
<span class="fill-remaining-space"></span> | ||
<!-- image action tools e.g. zoom, rotate and flip --> | ||
<span> | ||
<!-- zoom buttons --> | ||
<button mat-icon-button id="DSP_PDF_ZOOM_OUT" matTooltip="Zoom out" (click)="zoomFactor = zoomFactor - 0.2"> | ||
<mat-icon>remove_circle_outline</mat-icon> | ||
</button> | ||
<button mat-icon-button id="DSP_PDF_HOME" matTooltip="Reset zoom" (click)="zoomFactor = 1.0"> | ||
<mat-icon>adjust</mat-icon> | ||
</button> | ||
<button mat-icon-button id="DSP_PDF_ZOOM_IN" matTooltip="Zoom in" (click)="zoomFactor = zoomFactor + 0.2"> | ||
<mat-icon>add_circle_outline</mat-icon> | ||
</button> | ||
<a [href]="document.fileValue.fileUrl" download mat-icon-button id="DSP_PDF_DOWNLOAD" matTooltip="Open pdf in new tab"> | ||
<mat-icon>launch</mat-icon> | ||
</a> | ||
</span> | ||
</div> | ||
|
||
<pdf-viewer [src]="document.fileValue.fileUrl" [original-size]="false" [autoresize]="true" [show-all]="true" | ||
[show-borders]="true" [zoom]="zoomFactor" [zoom-scale]="'page-width'"> | ||
</pdf-viewer> | ||
</div> |
33 changes: 33 additions & 0 deletions
33
src/app/workspace/resource/representation/document/document.component.scss
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,33 @@ | ||
@import "../../../../../assets/style/config"; | ||
|
||
// sizes | ||
$max-width: 800px; | ||
$panelSize: 40px; | ||
|
||
$osd-height: 460px; | ||
|
||
// colors | ||
$dark: #000; | ||
$bright: #ccc; | ||
|
||
:host { | ||
|
||
.pdf-container { | ||
color: $bright; | ||
background-color: $dark; | ||
height: 100%; | ||
} | ||
|
||
.pdf-searchbox { | ||
border-radius: $border-radius; | ||
border: none; | ||
padding: 4px; | ||
|
||
&:active { | ||
border: none; | ||
} | ||
} | ||
|
||
|
||
} | ||
|
Oops, something went wrong.