aboutsummaryrefslogtreecommitdiff
path: root/src/documents/Documents.ts
diff options
context:
space:
mode:
authorAndrew Kim <andrewdkim@users.noreply.github.com>2019-02-26 17:49:46 -0500
committerAndrew Kim <andrewdkim@users.noreply.github.com>2019-02-26 17:49:46 -0500
commit3898ac2a436a1a6a39b07afb419f433e02df5e29 (patch)
tree43ebbdba88422fc5538efa2663750da8b050266b /src/documents/Documents.ts
parent0320123a5d0836dd11324a7eed6757a453c793d9 (diff)
In process of making the conversion from ImageBox to PDFNode
Diffstat (limited to 'src/documents/Documents.ts')
-rw-r--r--src/documents/Documents.ts52
1 files changed, 27 insertions, 25 deletions
diff --git a/src/documents/Documents.ts b/src/documents/Documents.ts
index 61d2e18b9..6dce4e8f0 100644
--- a/src/documents/Documents.ts
+++ b/src/documents/Documents.ts
@@ -11,6 +11,8 @@ import { ImageField } from "../fields/ImageField";
import { ImageBox } from "../views/nodes/ImageBox";
import { CollectionFreeFormView } from "../views/collections/CollectionFreeFormView";
import { FIELD_ID } from "../fields/Field";
+import {PDFField} from "../fields/PDFField";
+import {PDFNode} from "../views/nodes/PDFNode"
interface DocumentOptions {
x?: number;
@@ -127,31 +129,31 @@ export namespace Documents {
}
//for PDF
- //let PDFProtoId: FIELD_ID;
- //function GetPDFPrototype(): Document {
- //if (PDFProtoId === undefined) {
- //let PDFProto = new Document();
- //PDFProtoId = PDFProto.Id;
- //PDFProto.Set(KeyStore.Title, new TextField("PDF PROTO"));
- // PDFProto.Set(KeyStore.X, new NumberField(0));
- //PDFProto.Set(KeyStore.Y, new NumberField(0));
- //PDFProto.Set(KeyStore.Width, new NumberField(300));
- // PDFProto.Set(KeyStore.Height, new NumberField(300));
- // PDFProto.Set(KeyStore.Layout, new TextField(PDFBox.LayoutString()));
- //PDFProto.Set(KeyStore.LayoutKeys, new ListField([KeyStore.Data]));
- //Server.AddDocument(PDFProto);
- // return PDFProto;
- //}
- //return Server.GetDocument(PDFProtoId, true)!;
- //}
-
- //export function PDFDocument(url: string, options: DocumentOptions = {}): Document{
- //let doc = GetPDFPrototype().MakeDelegate();
- //setupOptions(doc, options);
- //doc.Set(KeyStore.Data, new PDFField(new URL(url)));
- //Server.AddDocument(doc);
- //return Server.GetDocument(doc.Id, true);
- //}
+ let PDFProtoId: FIELD_ID;
+ function GetPDFPrototype(): Document {
+ if (PDFProtoId === undefined) {
+ let PDFProto = new Document();
+ PDFProtoId = PDFProto.Id;
+ PDFProto.Set(KeyStore.Title, new TextField("PDF PROTO"));
+ PDFProto.Set(KeyStore.X, new NumberField(0));
+ PDFProto.Set(KeyStore.Y, new NumberField(0));
+ PDFProto.Set(KeyStore.Width, new NumberField(300));
+ PDFProto.Set(KeyStore.Height, new NumberField(300));
+ PDFProto.Set(KeyStore.Layout, new TextField(PDFNode.LayoutString()));
+ PDFProto.Set(KeyStore.LayoutKeys, new ListField([KeyStore.Data]));
+ Server.AddDocument(PDFProto);
+ return PDFProto;
+ }
+ return Server.GetDocument(PDFProtoId, true)!;
+ }
+
+ export function PDFDocument(url: string, options: DocumentOptions = {}): Document{
+ let doc = GetPDFPrototype().MakeDelegate();
+ setupOptions(doc, options);
+ doc.Set(KeyStore.Data, new PDFField(new URL(url)));
+ Server.AddDocument(doc);
+ return Server.GetDocument(doc.Id, true);
+ }
export function ImageDocument(url: string, options: DocumentOptions = {}): Document {
let doc = GetImagePrototype().MakeDelegate();