|
@@ -65,6 +65,7 @@ class ComPDFKitViewer {
|
|
|
uploadUrl: '/web-viewer/annotate/openPdfToAnnotate',
|
|
|
editUrl: '/web-viewer/annotate/edit',
|
|
|
saveUrl: '/web-viewer/annotate/save',
|
|
|
+ flattenUrl: '/web-viewer/annotate/saveAndFlatten',
|
|
|
uploadAnnotationsUrl: '/web-viewer/annotate/importAnnotateToPdf',
|
|
|
downloadAnnotation: '/web-viewer/annotate/exportAnnotate',
|
|
|
compareUrl: '/v1/pdf/compareto'
|
|
@@ -819,6 +820,41 @@ class ComPDFKitViewer {
|
|
|
this.percent = percent;
|
|
|
}
|
|
|
|
|
|
+ flattenPdfDownload () {
|
|
|
+ if (this._token && this._pdfId) {
|
|
|
+ const data = {
|
|
|
+ method: 'POST',
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ 'Authorization': this._token
|
|
|
+ },
|
|
|
+ body: JSON.stringify({
|
|
|
+ pdfId: this._pdfId
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return fetch(this.optionUrl.webviewBaseUrl + this.optionUrl.flattenUrl, data)
|
|
|
+ .then((res) => {
|
|
|
+ return res.json()
|
|
|
+ })
|
|
|
+ .then((data) => {
|
|
|
+ if (data.code === "200") {
|
|
|
+ console.log(data)
|
|
|
+ // this.downloadManager.downloadUrl(data.data.newFileUrl, this._docName)
|
|
|
+ saveAs(data.data.newFileUrl, this._docName)
|
|
|
+ return data.data.newFileUrl
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ return false
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
download (download = true) {
|
|
|
if (this._token && this._pdfId) {
|
|
|
const data = {
|