Skip to content
Snippets Groups Projects
Unverified Commit a5c1558a authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Prepare signature placement presetting (#5)

parent 7ac50c60
No related branches found
No related tags found
No related merge requests found
Pipeline #11145 passed
...@@ -109,8 +109,11 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) { ...@@ -109,8 +109,11 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
* *
* @param file * @param file
* @param isShowPlacement * @param isShowPlacement
* @param placementData
*/ */
async showPDF(file, isShowPlacement = false) { async showPDF(file, isShowPlacement = false, placementData = {}) {
// TODO: move signature if placementData was set
console.log(placementData);
this.isShowPlacement = isShowPlacement; this.isShowPlacement = isShowPlacement;
this.isShowPage = true; this.isShowPage = true;
let reader = new FileReader(); let reader = new FileReader();
...@@ -130,14 +133,15 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) { ...@@ -130,14 +133,15 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
// total pages in pdf // total pages in pdf
this.totalPages = this.pdfDoc.numPages; this.totalPages = this.pdfDoc.numPages;
const page = placementData.currentPage || 1;
// show the first page // show the first page
await this.showPage(1); await this.showPage(page);
this.isPageLoaded = true; this.isPageLoaded = true;
// fix width adaption after "this.isPageLoaded = true" // fix width adaption after "this.isPageLoaded = true"
await this.showPage(1); await this.showPage(page);
}; };
reader.readAsBinaryString(file); reader.readAsBinaryString(file);
...@@ -149,7 +153,7 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) { ...@@ -149,7 +153,7 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
* @param page_no * @param page_no
*/ */
async showPage(page_no) { async showPage(page_no) {
// we need to wait unil the last rendering is finished // we need to wait until the last rendering is finished
if (this.isPageRenderingInProgress) { if (this.isPageRenderingInProgress) {
return; return;
} }
......
...@@ -399,7 +399,10 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(VPUSignatureLitEle ...@@ -399,7 +399,10 @@ class QualifiedSignaturePdfUpload extends ScopedElementsMixin(VPUSignatureLitEle
console.log(file); console.log(file);
// start signature placement process // start signature placement process
this.signaturePlacementInProgress = true; this.signaturePlacementInProgress = true;
await this._("vpu-pdf-preview").showPDF(file, this.queuedFilesPlacementModes[key] === "manual"); await this._("vpu-pdf-preview").showPDF(
file,
this.queuedFilesPlacementModes[key] === "manual",
this.queuedFilesSignaturePlacements[key]);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment