Commit e4d2853f authored by xlou's avatar xlou Committed by Commit Bot

Print Preview: Set page index as pageIndex when pagesPerSheet > 1.

When sending URLs to the PDF plugin, the page index in the URL
needs to be the page index for the displayed PDF document.
When N-up > 1, this will not match the page index from the selected
pages in the UI, since the N-up page numbers will be recalculated
using the number of pages selected and pagesPerSheet Value.  The
new number of pages will be ceil(#pages selected/pagesPerSheet),
and the index of the N-up pages will start from 0.  Hence changing
the function onPagePreviewReady_ to use the N-upped document index
when pagesPerSheet > 1.

In printing, 2-up, 3-up, or more generally N-up refers to a page
layout strategy in which multiple pages are composited onto a
single page.

Bug: 775999
Change-Id: I1488431713815b573eb2798e23b011417b9fa46d
Reviewed-on: https://chromium-review.googlesource.com/1155906
Commit-Queue: Shirleen Lou <xlou@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579588}
parent 25406959
......@@ -480,7 +480,13 @@ Polymer({
if (this.inFlightRequestId_ != previewResponseId)
return;
const pageNumber = pageIndex + 1;
const index = this.getSettingValue('pages').indexOf(pageNumber);
let index = this.getSettingValue('pages').indexOf(pageNumber);
// When pagesPerSheet > 1, the backend will always return page indices 0 to
// N-1, where N is the total page count of the N-upped document.
const pagesPerSheet =
/** @type {number} */ (this.getSettingValue('pagesPerSheet'));
if (pagesPerSheet > 1)
index = pageIndex;
if (index == 0)
this.onPreviewStart_(previewUid, pageIndex);
if (index != -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment