Hello,
I’m currently working with the angular frontend with HTML rendering of the documents. Currently, the getFitToHeight and getFitToWidth functions currently return 100 which is invalid for some of the docx and pdf files. The page width and height are not retrieved from the GetViewOptions (although, it looks like that only works for JPG and PNG rendering) and the width and height are set to 0. What are the options to get the correct dimensions for docx and pdf files for the functions below:
getFitToHeight() {
/** @type {?} */
const pageWidth = this.formatIcon && (this.formatIcon === "file-excel" || this.formatIcon === "file-image") ? this._pageWidth : this.ptToPx(this._pageWidth);
/** @type {?} */
const pageHeight = this.formatIcon && (this.formatIcon === "file-excel" || this.formatIcon === "file-image") ? this._pageHeight : this.ptToPx(this._pageHeight);
/** @type {?} */
const windowHeight = (pageHeight > pageWidth) ? window.innerHeight - 100 : window.innerHeight + 100;
/** @type {?} */
const offsetHeight = pageHeight ? pageHeight : windowHeight;
return (pageHeight > pageWidth) ? Math.round(windowHeight * 100 / offsetHeight) : Math.round(offsetHeight * 100 / windowHeight);
}
getFitToWidth() {
// Images and Excel-related files receiving dimensions in px from server
/** @type {?} */
console.log(this.formatIcon);
const pageWidth = this.formatIcon && (this.formatIcon === "file-excel" || this.formatIcon === "file-image") ? this._pageWidth : this.ptToPx(this._pageWidth);
/** @type {?} */
const pageHeight = this.formatIcon && (this.formatIcon === "file-excel" || this.formatIcon === "file-image") ? this._pageHeight : this.ptToPx(this._pageHeight);
/** @type {?} */
const offsetWidth = pageWidth ? pageWidth : window.innerWidth;
return (pageHeight > pageWidth && Math.round(offsetWidth / window.innerWidth) < 2) ? 200 - Math.round(offsetWidth * 100 / window.innerWidth) : Math.round(window.innerWidth * 100 / offsetWidth);
}