diff --git a/libcef/renderer/extensions/print_render_frame_helper_delegate.cc b/libcef/renderer/extensions/print_render_frame_helper_delegate.cc index 6044850f0..2e5bda344 100644 --- a/libcef/renderer/extensions/print_render_frame_helper_delegate.cc +++ b/libcef/renderer/extensions/print_render_frame_helper_delegate.cc @@ -39,10 +39,14 @@ blink::WebElement CefPrintRenderFrameHelperDelegate::GetPdfElement( url.host_piece() == extension_misc::kPdfExtensionId; if (inside_print_preview || inside_pdf_extension) { // with id="plugin" is created in - // chrome/browser/resources/pdf/pdf.js. - auto plugin_element = frame->GetDocument().GetElementById("plugin"); - if (!plugin_element.IsNull()) { - return plugin_element; + // chrome/browser/resources/pdf/pdf_viewer_base.js. + auto viewer_element = frame->GetDocument().GetElementById("viewer"); + if (!viewer_element.IsNull() && !viewer_element.ShadowRoot().IsNull()) { + auto plugin_element = + viewer_element.ShadowRoot().QuerySelector("#plugin"); + if (!plugin_element.IsNull()) { + return plugin_element; + } } NOTREACHED(); }