Re: [chromium-dev] 'print' is not fired after clicking print in print preview.

52 views
Skip to first unread message
Message has been deleted

rbpotter

unread,
Oct 6, 2017, 8:16:29 PM10/6/17
to ziv...@gmail.com, Chromium-dev
1. If you mean devtools, you should be able to launch print preview, right click on the dialog and select "Inspect" from the context menu.
2. There were a significant number of changes made to print preview between 59 and 62. Without more information on what parts of the print preview code you are working with or modifying, it is hard to say what exactly the issue might be. Can you point to a patch?

On Fri, Oct 6, 2017 at 4:48 PM, <ziv...@gmail.com> wrote:
Hi All,

I am working on implementing 'print preview' in Chromium Embedded Framework. I got it working properly in CEF 3071 which uses chromium 59.

Now I am trying to merge my branch to mainline CEF which has chromium 62.0.3202.0.

But after merging I am getting an issue. When I click on 'print' in the print preview dialog, the dialog is hidden but the print is not initiated. 

I have tracked the webui's message handling, the 'print' message is never passed from the front end to c++ code. And according to the front end js implementation, there will be a 'print' message fired as soon as onPreviewGenerationDone_ is triggered.

I can see the preview generated on the print preview dialog so I guess the isPreviewGenerationInProgress_ showed already been set to false. Also I am confused why this happens in newer builds but not in the early versions. 

Walked through the js code, it seems like it might have been early returned in those conditions:
      var okToPrint =
          (this.uiState_ == PrintPreviewUiState_.PRINTING ||
           this.uiState_ == PrintPreviewUiState_.OPENING_PDF_PREVIEW ||
           this.uiState_ == PrintPreviewUiState_.FILE_SELECTION ||
           this.isInKioskAutoPrintMode_) &&
          this.destinationStore_.selectedDestination &&
          this.destinationStore_.selectedDestination.capabilities;
      if (!okToPrint) {
        return print_preview.PrintAttemptResult_.NOT_READY;
      }
      if (this.isPreviewGenerationInProgress_) {
        return print_preview.PrintAttemptResult_.READY_WAITING_FOR_PREVIEW;
      }

Therefore I would like to debug the front-end side of the print preview dialog to find out. But I couldn't seen to find a way to do it. Here are some questions I have:

1. How can I launch webkit inspector in print preview dialog?
2. Is there any particular change between 59 and 62 around print preview should I look into?


Thanks,
zhengzhou

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/02af9d08-1200-4b3b-ab00-4775e60bbefc%40chromium.org.

ziv...@gmail.com

unread,
Oct 9, 2017, 4:45:44 PM10/9/17
to Chromium-dev, ziv...@gmail.com
Hi rbpotter,

Thanks for you quick reply and instructions.

1. Since I am developing this issue for Chromium Embedded Framework, it has its' own implementation around devtool. I am not able to launch the devtool there in the print preview.
2. In order to narrow down the changes, I will try to implement it in chromium 61 and see it it works properly. Please find the patch in the attachment.

Here are some reasoning about the changes I made, I hope this could help you navigate through the changes.
1. print preview will be initiated by PrintViewManager instead of CefPrintViewManager because PrintPreviewHandler will try to retrieve a PrintViewManager. One solution is to create a Cef version of those classes, but that will involve a lot of files so I didn't do that.
2. The 'path' related patch are used for enable the download manager. Which will be used by 'print to pdf' in print preview.

Best regards,
print_preview_patch.txt
Reply all
Reply to author
Forward
0 new messages