aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
authordinhanhtruong <70963346+dinhanhtruong@users.noreply.github.com>2021-08-30 22:37:59 -0400
committerdinhanhtruong <70963346+dinhanhtruong@users.noreply.github.com>2021-08-30 22:37:59 -0400
commit26e265c6fc4950b859724aa2c0fbe6a028a56bfc (patch)
treef8171faa668cc311cd3010e491e291ecc6be460b /src/client/documents/Documents.ts
parent2df1a0c0cc11c0dbcebf2a53e804cf8ac28db346 (diff)
parent2d2e027f11253834a337680bbfd1ac549bb2a1f0 (diff)
Merge branch 'master' into linking-anh
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 08b2b8964..a2d0534be 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -710,10 +710,20 @@ export namespace Docs {
}
export function PdfDocument(url: string, options: DocumentOptions = {}) {
+ const width = options._width || undefined;
+ const height = options._height || undefined;
+ const nwid = options._nativeWidth || undefined;
+ const nhght = options._nativeHeight || undefined;
+ if (!nhght && width && height && nwid) options._nativeHeight = Number(nwid) * Number(height) / Number(width);
return InstanceFromProto(Prototypes.get(DocumentType.PDF), new PdfField(url), options);
}
export function WebDocument(url: string, options: DocumentOptions = {}) {
+ const width = options._width || undefined;
+ const height = options._height || undefined;
+ const nwid = options._nativeWidth || undefined;
+ const nhght = options._nativeHeight || undefined;
+ if (!nhght && width && height && nwid) options._nativeHeight = Number(nwid) * Number(height) / Number(width);
return InstanceFromProto(Prototypes.get(DocumentType.WEB), url ? new WebField(url) : undefined, options);
}