CefSharp browser jumps (scrolls up) when "PrintToPdfAsync" method is called - cefsharp

I am using the "PrintToPdfAsync" method https://cefsharp.github.io/api/63.0.0/html/M_CefSharp_WebBrowserExtensions_PrintToPdfAsync.htm to export HTML view to pdf. However I am experiencing following issues:
With this API (PrintToPdfAsync), I am unable to pass complete "viewport" that I want to be exported. I can pass width and height (possibly page dimension in micron). Question: How cefSharp determines the "view port"? Which element window or body?
The major issue I am experiencing is that just after the call to the method, "view is scrolled up", thereby the exported pdf does not contain the expected view port area.
Details here: https://github.com/cefsharp/CefSharp/discussions/4115

Related

download from popup in Casperjs

I'm scraping a weird ASP-based site. I want to download an XML file. To get the download normally, I fill out a form, click "download", then a popup comes up and the file downloads automatically (in both chrome and firefox).
What seems to ultimately trigger the download is a GET request to an 'www.HOST.content/xmlfile.aspx' url which gets a 'content-disposition:attachment' with a filename 'xmldocumentIcareabout.xml'
While I can see this request/response using the developer console in chrome (on the popup page), I do not see these events in 'resource.requested' or 'resource.received' on the Casperjs side.
What I've tried so far:
Explicit call to 'this.download('www.HOST.content/xmlfile.aspx')
Post call using the form: 'this.download('www.HOST.content/form.aspx',downloadPath,'POST', postBody)' where 'postBody' has all the form information and the __EVENT_TARGET
Trying to replicate the GET request with this.open('www.HOST.content/xmlfile.aspx')
What other approaches can be used so that I can catch an automatic download event from a popup window in Casperjs?
Fixed by calling 'download()' within the popUp frame (in the 'then()' function of 'withPopup()'

QWebView: Get size of the content

does anybody know how to retrieve the Size of the content within a QWebView?
I've tried
QWebView v;
...
v.page()->mainFrame()->contentsSize();
but this always returns 640x480, independend of the current Content.
There are two caveats with the mentioned v.page().mainFrame().contentsSize().
wait until the page has finished loading
The mentioned method only works properly if the content has finished loading. You can not call it directly after a call to v.load(QUrl("https://example.com"));. Instead, connect to the loadFinished(bool) signal and wait for it to be emitted. Even if you set some static HTML with no external references with v.setHtml(const QString&), you still have to wait for the loadFinished(bool) signal to be emitted.
set preferredContentsSize to a smaller value
If your page is smaller than 800x600, then you probably want to set the QWebPage::preferredContentsSize to something small before loading the new page. If you do not do that, the v.page().mainFrame().contentsSize() will always return 800x600. However, the page will not be rendered wider than the specified preferred width but it can be rendered higher/longer than the specified height.
You should decide on a QWebPage::preferredContentsSize before loading the first page. Prepare for heavy rendering bugs when passing a smaller size than the QWebView widget had before to QWebPage::setPreferredContentSize after a previous page has already been rendered. (I am using Qt 5.212.0)

Xpages data view icon column with Boostrap4XPages

I'm currently trying to display an icon in a data view. The configuration of the icon column is very simple, selectedValue is equal to 1 and the icon to be displayed is in the icon resources of the database. The xpages theme is currently set to Bootstrap4XPages. The page does not display in the browser. When I set the theme to OneUI, the page displays fine with the icon. Can anyone indicate a way to debug this? Here is a snippet of the error-log on the domino server. I removed most of the exception values to keep the post as short as possible. :
<CommonBaseEvent creationTime="2015-01-12T13:49:54.885-05:00" globalInstanceId="EL0a94000600014a3fc8c8ac000001c0" msg="CLFAD0246E: Exception occurred servicing request for: /test.nsf/test.xsp - HTTP Code: 500" severity="50" version="1.0.1">
<extendedDataElements name="CommonBaseEventLogRecord:level" type="noValue">
<children name="CommonBaseEventLogRecord:name" type="string">
<values>GRAVE</values>
</children>
</extendedDataElements>
<extendedDataElements name="CommonBaseEventLogRecord:sourceClassName" type="string">
<values>com.ibm.domino.xsp.bridge.http.engine.XspCmdManager</values>
</extendedDataElements>
<extendedDataElements name="CommonBaseEventLogRecord:sourceMethodName" type="string">
<values>service</values>
</extendedDataElements>
<extendedDataElements name="CommonBaseEventLogRecord:Exception" type="string">
<values>Context Path: /test.nsf
Page Name: /test.xsp
java.lang.NullPointerException: Argument Error: One or more parameters are null.
at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.writeAttribute(HtmlResponseWriter.java:308)
at com.ibm.xsp.theme.bootstrap.renderkit.html.extlib.data.DataViewRenderer.writeIconColumn(DataViewRenderer.java:267)
at com.ibm.xsp.extlib.renderkit.html_extended.data.DataViewRenderer.writeStandardRow(DataViewRenderer.java:792)
at com.ibm.xsp.extlib.renderkit.html_extended.data.DataViewRenderer.writeRow(DataViewRenderer.java:570)
at com.ibm.xsp.extlib.renderkit.html_extended.data.AbstractDataViewRenderer.writeRows(AbstractDataViewRenderer.java:816)
at com.ibm.xsp.extlib.renderkit.html_extended.data.DataViewRenderer.writeRows(DataViewRenderer.java:548)
at com.ibm.xsp.extlib.renderkit.html_extended.data.DataViewRenderer.writeContent(DataViewRenderer.java:256</values>
</extendedDataElements>
<sourceComponentId component="Expeditor 6.2" componentIdType="ProductName" instanceId="" location="notes" locationType="Hostname" subComponent="" threadId="1" componentType="http://www.w3.org/2001/XMLSchema-instance"/>
<situation categoryName="ReportSituation">
<situationType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ReportSituation" reasoningScope="INTERNAL" reportCategory="LOG"/>
</situation>
</CommonBaseEvent></CommonBaseEvents>
The problem lies here from the error: com.ibm.xsp.theme.bootstrap.renderkit.html.extlib.data.DataViewRenderer.writeIconColumn(DataViewRenderer.java:267)
It is a bug, one that I discovered myself just recently. I have a fix identified for it that we will release in the next extlib version (not sure when that will be). When the title attribute is left empty for the icon, it attempts to use the alt attribute as a title instead. The problem is it doesnt check if an alt value exists, and when it doesn't it tries to write null as an attribute, and you get the NullPointerException. Simple fix in the DataViewRenderer code.
I think you can work around the issue though if you set either the title or alt attributes of the image icon. So give that a go for now.
Check devtools (browser debug tools) and see if there is an Icon in the html code and see it the path is valid. If there is no icon then maybe the bootstrap plugin may not support it.
Either way, you can always easily add an icon client side using jQuery or plain client side JavaScript

Dynamics CRM 2011 Modal Web Resource from Ribbon button size incorrect (IE only)

I am working on Dynamics CRM 2011 (UR13) and trying to display an HTML Web resource (which contains a Silverlight XAP file) as a Modal Dialog from a Ribbon Button.
The Ribbon action XML is as below. More or like the MSDN examples.
<Actions>
<Url Address="$webresource:new_Wizard.htm" PassParams="true" WinMode="1" WinParams="dialogHeight=100; dialogWidth=100" />
</Actions>
In both Chrome and Firefox, the dialogHeight and dialogWidth values are honoured.
However, in IE9 (the RTM supported version) these are ignored and the pop-up window is huge (almost full screen).
Has anyone else seen this behaviour or know a workaround?
Best Regards,
Shaun Harvey
I am opening up the HTML Web Resource from a Javascript Function instead (triggered by the click of the Ribbon Button).
This function uses the Xrm.Utility.openWebResource() method introduced in Roll-Up 8 of CRM 2011.
http://msdn.microsoft.com/en-gb/library/jj602956(v=crm.5).aspx
The Function call allows you to specify the web resource URL, and the size of the pop-up window.
Xrm.Utility.openWebResource("new_webResource.htm?typename=account&userlcid=1033", null, 300, 300);
This seems to be rendered properly by all three of the browsers.
As a possible workaround you can choose one of 2 options:
1. Add OnLoad javascript to your html webresourse that will set correct size to your dialog window.
2. Replace action with JavaScript function that will open your dialog window with proper sizing.

flex app and title missing in browser

does anyone know why my title isint displaying in browser when i embed a flex object? When the page is loading it shows the title but then when its fully loaded it goes again
The culprit might be the IBrowserManager. Are you using it? And if you are, are you calling its init() method with a null value for the title argument when your application initializes?

Resources