aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
authorandrewdkim <46148447+andrewdkim@users.noreply.github.com>2019-03-09 18:37:10 -0500
committerGitHub <noreply@github.com>2019-03-09 18:37:10 -0500
commit36830f4677997ce190e0c18bad7bd5ffbeab86b0 (patch)
tree1ff38ba44c3567ed1ef09fc2107da8b4ffb7d1b0 /src/client/documents/Documents.ts
parentb9cfa458a6535e7ee0ff8b81398afa1e123cf458 (diff)
parent96eede5f7d1706a3f7ac6ee02a85bb3da217f467 (diff)
Merge branch 'master' into audiovideo
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index f81ad3188..a91834cca 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -19,6 +19,9 @@ import { VideoField } from "../../fields/VideoField"
import { VideoBox } from "../views/nodes/VideoBox";
import { AudioField } from "../../fields/AudioField";
import { AudioBox } from "../views/nodes/AudioBox";
+import { PDFField } from "../../fields/PDFField";
+import { PDFBox } from "../views/nodes/PDFBox";
+import { CollectionPDFView } from "../views/collections/CollectionPDFView";
export interface DocumentOptions {
x?: number;
@@ -44,7 +47,9 @@ export namespace Documents {
let kvpProto: Document;
let videoProto: Document;
let audioProto: Document;
+ let pdfProto: Document;
const textProtoId = "textProto";
+ const pdfProtoId = "pdfProto";
const imageProtoId = "imageProto";
const webProtoId = "webProto";
const collProtoId = "collectionProto";
@@ -100,6 +105,15 @@ export namespace Documents {
textProto = setupPrototypeOptions(textProtoId, "TEXT_PROTO", FormattedTextBox.LayoutString(),
{ x: 0, y: 0, width: 300, height: 150, layoutKeys: [KeyStore.Data] });
}
+ function GetPdfPrototype(): Document {
+ if (!pdfProto) {
+ pdfProto = setupPrototypeOptions(pdfProtoId, "PDF_PROTO", CollectionPDFView.LayoutString("AnnotationsKey"),
+ { x: 0, y: 0, nativeWidth: 600, width: 300, layoutKeys: [KeyStore.Data, KeyStore.Annotations] });
+ pdfProto.SetNumber(KeyStore.CurPage, 1);
+ pdfProto.SetText(KeyStore.BackgroundLayout, PDFBox.LayoutString());
+ }
+ return pdfProto;
+ }
function GetWebPrototype(): Document {
return webProto ? webProto :
webProto = setupPrototypeOptions(webProtoId, "WEB_PROTO", WebBox.LayoutString(),
@@ -155,6 +169,9 @@ export namespace Documents {
export function TextDocument(options: DocumentOptions = {}) {
return SetInstanceOptions(GetTextPrototype(), options, "", TextField);
}
+ export function PdfDocument(url: string, options: DocumentOptions = {}) {
+ return SetInstanceOptions(GetPdfPrototype(), options, new URL(url), PDFField);
+ }
export function WebDocument(url: string, options: DocumentOptions = {}) {
return SetInstanceOptions(GetWebPrototype(), options, new URL(url), WebField);
}
@@ -176,8 +193,6 @@ export namespace Documents {
return assignOptions(deleg, options);
}
-
-
// example of custom display string for an image that shows a caption.
function EmbeddedCaption() {
return `<div style="height:100%">