Closed Bug 1247422 Opened 8 years ago Closed 7 years ago

Expose printing resolution and scaling via CanvasPrintState

Categories

(Core :: Printing: Output, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: tschneider, Assigned: tschneider)

References

(Depends on 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

In order to render pages in PDF.js that mach the printers DPI when printing, the CanvasPrintState, passed to mozPrintCallback handlers, should contain a printerPixelRatio property so that drawing commands to the printing context can be scaled appropriately.
Blocks: 1246805
Part 1: Expose printingPixelRatio in CanvasPrintState
Attachment #8718087 - Attachment description: bug1247422.diff → Part 1: Expose printingPixelRatio in CanvasPrintState
Assignee: nobody → tschneider
Comment on attachment 8718087 [details] [diff] [review]
Part 1: Expose printingPixelRatio in CanvasPrintState

Robert, asking you to review this since you also reviewed the original patch that introduced the mozPrintCallback event.
Attachment #8718087 - Flags: review?(roc)
Attached patch Part 2: ReftestsSplinter Review
Added ref test. To make this a reliable test I had to change the print preview scaling to something different than the page scaling in nsDocumentViewer.cpp. This doesn't seem to affect other tests, except of the original mozPrintCallBack reftest, which gets updated by this patch as well.
Attachment #8718087 - Flags: review?(mstange)
Summary: Expose printer DPI via CanvasPrintState → Expose printing resolution and scaling via CanvasPrintState
Update patch to also expose the scaling applied on the canvas for printing
Attachment #8718087 - Attachment is obsolete: true
Attachment #8718087 - Flags: review?(mstange)
Attachment #8736596 - Flags: review?(mstange)
Comment on attachment 8736596 [details] [diff] [review]
Part 1 (v2): Expose printingPixelRatio in CanvasPrintState

Review of attachment 8736596 [details] [diff] [review]:
-----------------------------------------------------------------

This seems fine because it's needed when web content creates its own intermediate surfaces.

::: layout/base/nsDocumentViewer.cpp
@@ +842,4 @@
>                   mPresContext->CSSTwipsToAppUnits(NSToIntFloor(pageHeight))));
>          mPresContext->SetIsRootPaginatedDocument(true);
>          mPresContext->SetPageScale(1.0f);
> +        mPresContext->SetPrintPreviewScale(1.5f);

Does this have an effect on anything other than the new printing reftest you're adding?
Attachment #8736596 - Flags: review?(mstange) → review+
>> Does this have an effect on anything other than the new printing reftest you're adding?

No.
Ok. Please add a comment to that line, explaining why you chose 1.5, what it's used for, and why it doesn't affect anything else, and also add a comment to the reftest pointing to this function so that readers know where the number is coming from.
I don't see you declare 'scale' in PrePrintNextPage.
Doesn't compiler complain it?

@@ -681,7 +681,7 @@ nsSimplePageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, bool* a
 
         // Start the rendering process.
         nsWeakFrame weakFrame = this;
-        canvas->DispatchPrintCallback(aCallback);
+        canvas->DispatchPrintCallback(aCallback, scale);
         NS_ENSURE_STATE(weakFrame.IsAlive());
Flags: needinfo?(tschneider)
Won't fix since we will focus on other efforts to optimize quality of printing PDF's (see bug 1269760).
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(tschneider)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: