2016-12-08 16:42:53 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/parsers/pdfparser.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: parser
|
|
|
|
|
|
|
|
The PDF parser embeds a PDF viewer
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var ImageParser = function(type,text,options) {
|
|
|
|
var element = {
|
|
|
|
type: "element",
|
2023-01-19 17:01:53 +00:00
|
|
|
tag: "iframe",
|
2016-12-08 16:42:53 +00:00
|
|
|
attributes: {}
|
|
|
|
},
|
|
|
|
src;
|
|
|
|
if(options._canonical_uri) {
|
|
|
|
element.attributes.src = {type: "string", value: options._canonical_uri};
|
|
|
|
} else if(text) {
|
|
|
|
element.attributes.src = {type: "string", value: "data:application/pdf;base64," + text};
|
|
|
|
}
|
|
|
|
this.tree = [element];
|
2022-05-08 19:48:33 +00:00
|
|
|
this.source = text;
|
|
|
|
this.type = type;
|
2016-12-08 16:42:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports["application/pdf"] = ImageParser;
|
|
|
|
|
|
|
|
})();
|
|
|
|
|