MCPcopy Index your code
hub / github.com/webodf/ViewerJS / updatePageDimensions

Function updatePageDimensions

PDFViewerPlugin.js:115–140  ·  view source on GitHub ↗
(page, width, height)

Source from the content-addressed store, hash-verified

113 }
114
115 function updatePageDimensions(page, width, height) {
116 var domPage = getDomPage(page),
117 canvas = domPage.getElementsByTagName('canvas')[0],
118 textLayer = domPage.getElementsByTagName('div')[0],
119 cssScale = 'scale(' + scale + ', ' + scale + ')';
120
121 domPage.style.width = width + "px";
122 domPage.style.height = height + "px";
123
124 canvas.width = width;
125 canvas.height = height;
126
127 textLayer.style.width = width + "px";
128 textLayer.style.height = height + "px";
129
130 CustomStyle.setProp('transform', textLayer, cssScale);
131 CustomStyle.setProp('transformOrigin', textLayer, '0% 0%');
132
133 if (getRenderingStatus(page) === RENDERING.RUNNING) {
134 // TODO: should be able to cancel that rendering
135 setRenderingStatus(page, RENDERING.RUNNINGOUTDATED);
136 } else {
137 // Once the page dimension is updated, the rendering state is blank.
138 setRenderingStatus(page, RENDERING.BLANK);
139 }
140 }
141
142 function ensurePageRendered(page) {
143 var domPage, textLayer, canvas;

Callers 2

createPageFunction · 0.85
PDFViewerPluginFunction · 0.85

Calls 3

getDomPageFunction · 0.85
getRenderingStatusFunction · 0.85
setRenderingStatusFunction · 0.85

Tested by

no test coverage detected