hsu-utils 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
package/es/RenderPDF/index.js
CHANGED
package/lib/RenderPDF/index.js
CHANGED
@@ -43,22 +43,17 @@ function load(pdfUrl) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function () {
|
44
44
|
var pdf, loadingTask;
|
45
45
|
return __generator(this, function (_a) {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
return [4, loadingTask.promise];
|
56
|
-
case 1:
|
57
|
-
pdf = _a.sent();
|
58
|
-
PDFMap.set(pdfUrl, pdf);
|
59
|
-
_a.label = 2;
|
60
|
-
case 2: return [2, pdf];
|
46
|
+
pdf = PDFMap.get(pdfUrl);
|
47
|
+
if (!pdf) {
|
48
|
+
loadingTask = (0, pdf_js_1.getDocument)({
|
49
|
+
url: pdfUrl,
|
50
|
+
cMapUrl: 'https://unpkg.com/browse/pdfjs-dist@2.13.216/cmaps/',
|
51
|
+
cMapPacked: true
|
52
|
+
});
|
53
|
+
pdf = loadingTask.promise;
|
54
|
+
PDFMap.set(pdfUrl, pdf);
|
61
55
|
}
|
56
|
+
return [2, pdf];
|
62
57
|
});
|
63
58
|
});
|
64
59
|
}
|