mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Merge pull request #16241 from fchasen/bug_1820651
[Firefox] Add CSS at-page size when printing from FirefoxPrintService (bug 1820651)
This commit is contained in:
commit
65c4a4b3fe
3 changed files with 44 additions and 12 deletions
|
@ -1666,21 +1666,27 @@ class PDFViewer {
|
|||
* @returns {Array} Array of objects with width/height/rotation fields.
|
||||
*/
|
||||
getPagesOverview() {
|
||||
let initialOrientation;
|
||||
return this._pages.map(pageView => {
|
||||
const viewport = pageView.pdfPage.getViewport({ scale: 1 });
|
||||
|
||||
if (!this.enablePrintAutoRotate || isPortraitOrientation(viewport)) {
|
||||
const orientation = isPortraitOrientation(viewport);
|
||||
if (initialOrientation === undefined) {
|
||||
initialOrientation = orientation;
|
||||
} else if (
|
||||
this.enablePrintAutoRotate &&
|
||||
orientation !== initialOrientation
|
||||
) {
|
||||
// Rotate to fit the initial orientation.
|
||||
return {
|
||||
width: viewport.width,
|
||||
height: viewport.height,
|
||||
rotation: viewport.rotation,
|
||||
width: viewport.height,
|
||||
height: viewport.width,
|
||||
rotation: (viewport.rotation - 90) % 360,
|
||||
};
|
||||
}
|
||||
// Landscape orientation.
|
||||
return {
|
||||
width: viewport.height,
|
||||
height: viewport.width,
|
||||
rotation: (viewport.rotation - 90) % 360,
|
||||
width: viewport.width,
|
||||
height: viewport.height,
|
||||
rotation: viewport.rotation,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue