Commit 668ba311 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Fix PDF printing for mixed page sizes and annotations.

PDF contents have to be fit into the printable area before the PDF gets
flattened for printing. Otherwise some PDFs will not print correctly.
r554188 flipped the ordering, so this flips it back.

BUG=873840

Change-Id: I68a05d0951caa31080b3b9bb424d458a899b92a7
Reviewed-on: https://chromium-review.googlesource.com/1237719Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593258}
parent c2747b15
......@@ -331,19 +331,17 @@ pp::Buffer_Dev PDFiumPrint::PrintPagesAsPDF(
return pp::Buffer_Dev();
}
// Now flatten all the output pages.
if (!FlattenPrintData(output_doc.get()))
return pp::Buffer_Dev();
pp::Buffer_Dev buffer;
uint32_t pages_per_sheet = pdf_print_settings.pages_per_sheet;
uint32_t scale_factor = pdf_print_settings.scale_factor;
if (ShouldDoNup(pages_per_sheet)) {
buffer = NupPdfToPdf(output_doc.get(), pages_per_sheet, print_settings);
if (FlattenPrintData(output_doc.get()))
buffer = NupPdfToPdf(output_doc.get(), pages_per_sheet, print_settings);
} else {
FitContentsToPrintableAreaIfRequired(output_doc.get(),
scale_factor / 100.0f, print_settings);
buffer = GetPrintData(output_doc.get());
if (FlattenPrintData(output_doc.get()))
buffer = GetPrintData(output_doc.get());
}
return buffer;
......
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