Cannot print from a website provided Print link using CefSharp - cefsharp

A webpage has links to start a print job on it. Clicking the link initiates a new popup window and then immediately the print dialog is shown. The popup window is not rendered and if I click print, then a blank page is printed. It appears that the print dialog is blocking the popup from rendering the page first. If I cancel the print dialog the popup renders properly but now there is no print dialog.
The behavior is the same when using the CefSharp Winforms example.
Is this something I need to deal with? Can I dismiss the print dialog, let the page render and then call the dialog again?
The TargetURL of the popup is about:blank which does not give me much to go on that it is a print action. How does CefSharp tell you it has been asked to print something?
For people landing here from Google printing seems to be rather limited in CEF still and thus in CefSharp. See General Usage Printing and Silently Printing and also Kiosk Printing for example.
Also there is a PrintToPDF which I have not tried yet.
Looking at how Google Chrome does this it appears it renders the page to a PDF file and then shows this file in a popup/new tab. Of course they have then built their own silent printing as the next step.
Edit
Using cef_binary_3.3683.1920.g9f41a27_windows64_client with
No extra arguments
clicking exactly the same link
a popup window appears
the print window appears
the popup window navigates to display preview of what is to be printed
Print can be clicked to print the information viewed in the popup
Using CEFSharp Master WinForms version
No extra arguments (other than set by the example at startup)
clicking exactly the same link
a popup window appears
the print window appears
the popup window appears blocked and is blank.
Print can be clicked and it prints a beautiful white blank page.
AFTER print window closes the popup window navigates to the information to be printed.

Related

Console preview panel - how to reset size?

So the console preview panel at the bottom of the page remembers how big you had it last time you previewed. Usually this is great! But somehow mine is currently maximized, so the only thing that shows up is the Page dropdown at the top of the page (and anything in the console, if I switch between pages and the pages have things that log on load). The rest is just white console. Any idea how to get back the default view where the console is 20% of the bottom of the page? There is no visible dragging bar frame thing anywhere.
I can change my preview to console=0 to be able to use it, but I'd like a way to restore the default position of the panel.
Normally you should be able to hover on the top border of the console panel and resize it as you wish. An icon will appear, similar as in the image below:
Nonetheless, if you are doing your previews on a mobile device such as a tablet, then such thing is not possible to do. Therefore; a hacky way to do it would be to put the following code on the onAttach event handler of the page that is loading:
var splitPanel = widget.root.getElement().parentElement
.parentElement.parentElement.parentElement
.parentElement.parentElement.children[0].children[3];
splitPanel.style.height = "75px";
Nota bene: this is intended to ONLY work in preview

Qt: Print entire WebPage with Preview Dialog

So, I'm trying to print a QWebEngineView entirely, but give a Preview Dialog, such as QPrintPreviewDialog would be sufficient.
First try was something along these lines:
self.loader = QWebEngineView()
[...]
dialog = QPrintPreviewDialog()
dialog.paintRequested.connect(self.loader.page().print)
dialog.show()
self.loader is also used as the actual view rendered to screen. In this setup I get one page sent to the preview and that is the current view in the window. But not the entire document, which is what I want.
I can simply call self.loader.page().print(), which works (prints everything) but gives me no preview option.
I then tried to be smart by using
self.loader.page().runJavaScript("window.print();")
But that doesn't appear to trigger any reaction whatsoever.
So, how do I get an entire WebView printed with a preview dialog beforehand?
In this case PyQt5/PySide2 would be preferred, but I can understand a regular Qt Solution just fine too.

Misplaced button in dialog window of JqGrid, works fine while developers tools opened

The strangest behaviour occured and I can't handle it myself.
I have ASP .NET MVC application with Jqgrid version 5.1.0. Everything works fine, beside one dialog window.
In my grid I use default deletion method. There is delete button defined by $(tableHtmlId).navGrid( ... ) function. After clicking delete button, confirmation dialog window appears. This dialog has misplaced cancel button (the one on top-right corner), as shown on following screen:
I thought about editing css styles, so I hit the console button, and as soon as develpers tool window appeard, look what happened:
Everything look fine. However, when I put cursor over cancel button, it goes back to wrong:
This behaviour occurs on Chrome, Firefox and IE. This bug is too atomic for me to solve. Please help. :)

window.open in web application for iPad running in fullscreen replaces the existing window

I am writing a simple (ASP.NET) web application for the iPad. It is written and works well however one feature is it serving up PDF files (among others). To do this I used window.open to open the file.
When this is done in Safari, it works perfectly. You click the button, the file opens in a new tab; you can then close the tab to return to the previous web page.
However now running the application in fullscreen mode - i.e. with the appropriate "meta names" set and from a shortcut on the home screen - when you click the button to load the file, it loads fullscreen with no means to get back to the last page.
Because it is a file, not a webpage, I can't put a "Back" button on, and when you press the iPad button it simply closes the whole thing.
I know this has been asked before and I have read a number of similar questions - the closest of which was this:
https://stackoverflow.com/questions/9168236/web-app-hyperlinks
If at all possible, it would be far preferable (thanks to the control library I am using) that the button click is done with javascript - it is not easy to set the link href.
The upshot is I really I just want to create a new window from within a fullscreen iPad web application, or allow the "back" navigation somehow...
Is this possible?
Thanks!
Create an iframe on your page rather than using an window.open and set that as the target.
That way your pdf would open within your existing window.
Use some client side javascript like jQuery to style it like a dialog window.

How to Open Print Friendly Page Windows?

Our users can currently select a number of funds from a page and go to another page to see the funds compared on a chart. I now have to present the user with an option to produce a print-friendly fact sheet page for each fund in the chart.
The requirement is that each page will open in a new window (or tab), and be minimised so as not to be 'too intrusive' when they're opened. Can somebody suggest how I could go about this? This also means that the user will have to go to each window or tab to print the page.
They also want the print dialog box open in each of the new windows so the user doesn't have to open it. Is this possible, for the print dialog to open at the page load? If so, can somebody suggest how - JavaScript?
I disagree that (up to) 10 new windows can ever be anything but intrusive! Ideally I could send these new pages directly to the print queue. Is this possible?
Otherwise, I could Generate a page dynamically for each fund, strip out the contents of the page body and add the content for that fund to a large single page print-friendly factsheet. Does anyone have experience in this kind of work? Any pointers?
several points
you cant control new tabs vs new windows, this is a browser setting.
if its tabs, you can only have one print dialog per browser instance (depends on browser, but generally speaking). It tends to be modal.
you can call window.print() on page load to trigger the print dialog automatically, but its not very user-friendly
Whats the problem with creating a print friendly css and simply having a print button on the page that calls window.print();

Resources