aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
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 007262f9c..ec856e748 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -729,10 +729,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);
}