aboutsummaryrefslogtreecommitdiff
path: root/src/fields/PDFField.ts
blob: 0db47a884e2fc24ca2fbb2a8b6eec6ab4ababbc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { BasicField } from "./BasicField";
import { Field } from "./Field";
import { observable } from "mobx"
import { Types } from "../server/Message";



export class PDFField extends BasicField<URL> {
    constructor(data: URL | undefined = undefined, save: boolean = true) {
        super(data || new URL("http://cs.brown.edu/~bcz/face.gif"), save);
    }

    toString(): string {
        return this.Data.href;
    }

    Copy(): Field {
        return new PDFField(this.Data);
    }

    ToScriptString(): string {
        return `new PDFField("${this.Data}")`;
    }

    ToJson(): { type: Types, data: URL, _id: string } {
        return {
            type: Types.PDF,
            data: this.Data,
            _id: this.Id
        }
    }

    @observable
    Page: Number = 1;

}