mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-08 08:49:52 +00:00
signature: POC of showing a pdf with vue-pdf-embed
This commit is contained in:
parent
bbfd0caf10
commit
21c1e77d36
@ -58,6 +58,7 @@
|
|||||||
"vue": "^3.2.37",
|
"vue": "^3.2.37",
|
||||||
"vue-i18n": "^9.1.6",
|
"vue-i18n": "^9.1.6",
|
||||||
"vue-multiselect": "3.0.0-alpha.2",
|
"vue-multiselect": "3.0.0-alpha.2",
|
||||||
|
"vue-pdf-embed": "^2.0.4",
|
||||||
"vue-toast-notification": "^2.0",
|
"vue-toast-notification": "^2.0",
|
||||||
"vuex": "^4.0.0"
|
"vuex": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>hello {{ msg }}</div>
|
<div>hello {{ msg }}</div>
|
||||||
|
<VuePdfEmbed :source="pdfSource" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, Ref } from "vue";
|
import { ref, Ref } from "vue";
|
||||||
|
import VuePdfEmbed from "vue-pdf-embed";
|
||||||
|
import "vue-pdf-embed/dist/style/index.css";
|
||||||
|
|
||||||
//import { build_download_info_link, download_and_decrypt_doc } from "ChillDocStoreAssets/vuejs/StoredObjectButton/helpers.js";
|
|
||||||
import {
|
import {
|
||||||
build_download_info_link,
|
build_download_info_link,
|
||||||
download_and_decrypt_doc,
|
download_and_decrypt_doc,
|
||||||
@ -18,16 +20,17 @@ const msg: Ref<string> = ref("world !");
|
|||||||
const signature = {
|
const signature = {
|
||||||
id: 1,
|
id: 1,
|
||||||
storedObject: {
|
storedObject: {
|
||||||
filename: "pKNlhCrQDCRsAuC8vYHDKa",
|
filename: "V2DZStOWtonw1TiKxzVPDRzlS4YO",
|
||||||
keyInfos: {
|
keyInfos: {
|
||||||
alg: "A256CBC",
|
alg: "A256CBC",
|
||||||
ext: true,
|
ext: true,
|
||||||
k: "_VihnD41-VDHlpS-ouwtbMPnu-OXVdtA7ENQWWtAQYM",
|
k: "x0vaQO0n3QZnipLEmddF3MOF_5_QYnS4g67n0AwZ6YA",
|
||||||
key_ops: ["encrypt", "decrypt"],
|
key_ops: ["encrypt", "decrypt"],
|
||||||
kty: "oct",
|
kty: "oct",
|
||||||
},
|
},
|
||||||
iv: [
|
iv: [
|
||||||
86, 231, 83, 148, 117, 107, 149, 173, 130, 19, 105, 194, 224, 145, 8, 48,
|
150, 175, 71, 136, 62, 123, 230, 141, 72, 204, 116, 110, 139, 22, 246,
|
||||||
|
114,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
zones: [{ page: 1, origin: [0, 0], x: 10, y: 10 }],
|
zones: [{ page: 1, origin: [0, 0], x: 10, y: 10 }],
|
||||||
@ -35,6 +38,8 @@ const signature = {
|
|||||||
|
|
||||||
const urlInfo = build_download_info_link(signature.storedObject.filename);
|
const urlInfo = build_download_info_link(signature.storedObject.filename);
|
||||||
|
|
||||||
|
let pdfSource: Ref<string> = ref("");
|
||||||
|
|
||||||
async function download_and_open(): Promise<Blob> {
|
async function download_and_open(): Promise<Blob> {
|
||||||
let raw;
|
let raw;
|
||||||
try {
|
try {
|
||||||
@ -43,10 +48,12 @@ async function download_and_open(): Promise<Blob> {
|
|||||||
signature.storedObject.keyInfos,
|
signature.storedObject.keyInfos,
|
||||||
new Uint8Array(signature.storedObject.iv)
|
new Uint8Array(signature.storedObject.iv)
|
||||||
);
|
);
|
||||||
|
//pdfSource.value = 'https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/examples/learning/helloworld.pdf';
|
||||||
|
pdfSource.value = URL.createObjectURL(raw);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("error while downloading and decrypting document", e);
|
console.error("error while downloading and decrypting document", e);
|
||||||
throw e;
|
throw e;
|
||||||
};
|
}
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user