Fast Html viewer QT - html

I want to open html file in qt app. This html is very big. it has 13000 lines. I used the QWebEngineView, but the problem is that it flips through the page with delays. I need a widget to work quickly with large html files. What idea is there for this?

Related

QWebEngine: export HTML pages > 2 MB to PDF

I’m facing an issue while displaying an HTML page (that I dynamically built) within QWebEngine because, as indicated in the doc here (https://doc.qt.io/qt-6/qwebengineview.html#setHtml), content larger than 2 MB cannot be displayed directly using setHtml().
As suggested in some SO posts, dumping my HTML code to a local file and then displaying it via QWebEngineView::load(QUrl::fromLocalFile()) allowed me to workaround this limitation.
However, I would also like to be able to export this page in PDF format, I tried via QWebEngineView::printToPdf() but it fails for such “big” pages (and works for normal pages).
Do you know how I could workaround this HTML to PDF export issue in Qt? I guess that I could try to use some 3rd party library/tool but, if possible, I’d like to avoid complicating too much the code.
Thanks in advance for your help!

Why isn't my HTML page loading completely?

I recently started my first HTML project with the help of Youtube. I'm a beginner and only saw the basics of Javascript in college.
Just finished writing my HTML project and wanted to upload it for free using Google Drive and drv.tw.
The only problem is that certain images and icons do not load (irregularly) enter image description hereand/or the pages on the navigation bar take too long to switch.
My question would be, is it because of the free domain or did I do something wrong in HTML?
When I open the HTML file in Safari everything works fine.
Since I'm new to the community, I don't know exactly what and how much I have to upload to get help. So have mercy on me :'D.
To help troubleshoot, use your browsers "developer" (F12) mode. Look at the Network view to see why the images aren't displayed. For example: It might be "not found", "not authorized", or other reasons.
From your comment, it would appear that at times the page is rendering before the images are available to display or something else is limiting image files from being presented at all.
Once we know why the browser can't display the images, then the cause can be addressed.
Post the .html .js and .css code
Please update your question and show the folder structure. It should look something like:
-site-
|
-js
-css
-images
Copy and paste in the code below the folder structure and list the images and their size.
I am not familiar with google drive's capabilities.
It is important to use a web host. There are plenty of free or low cost sites available, so I won't go into it.

asp .net mvc showing an image from local computer in view

So, I have an image on my computer. I make an html-page with simple code, src="file:\\\C:\...\file.png"
It's ok, image is shown.
Then I write the same code in mvc-view. Image isn't shown, firebug shows gray img code.. I have seen some tips about Url.Content, but they didn't help..
If you create an HTML file on your disk and open it in a browser (with a URL such as file:///mypage.html), then it can serve images straight from your hard disk (I believe) and no Web server is involved.
But once you start using ASP.NET, then you are no longer viewing through a file URL, but through a local web server (e.g. http://localhost/mypage) and only images that are deployed on your web server can be served. That can still easily be done, drag and drop images into your Visual Studio solution.

C# control / code to display local HTML file with image tags and CSS

I am developing an application and part of the design is there is a local folder with HTML files and a folder for images that the HTML files use.
The HTML files can have in-line CSS declaration which will also need to be displayed / rendered. The CSS will be VERY basic like font size , color, padding, etc, but nothing advanced like CSS 3.0 or even advance CSS 2.0 features.
The HTML files are not complicated, just text in tags with a few image tags in there with some CSS to style on some tags. There will be NO JavaScript, NO PHP, etc.. and all the files are local and not loaded from the web.
I can't seem to find a control or code online to display this kind of file contents. I have found some code that will display HTML code but it does not render CSS or render images. This control needs to be read only so the user can not edit the view.
I am using Visual Studio 2010 and my application uses WPF WinForms in .NET 4.0.
Just to clarify what I want, I want code to render the above HTML files on my form or a control that allows me to render those HTML files. The control needs to be able to support a scroll bar if the HTML file contents don't fit the control. The control also needs to be able to resize if the form is resized.
Thank you, I look forward to seeing some solutions to this problem! I have never done this before and am excited to see what is available and what you have done in the past to solve this problem!
Use the WebBrowser control and call the Navigate method with Uri pointing to your local file path of your HTML files. The browser control can be displayed inside any Wpf container (grid/border/stackpanel etc).
Reference example is available at msdn.

PdfSharp, GDI+ and HTML printing

I currently have a "PrintingWebService" that I call from an AJAX page with all the information that is needed to construct a highly customized PDF printout using PDF Sharp and the PDFSharp's GDI+ mode, which takes DrawString and other commands that work basically just like GDI+ only they are drawn to the PDF.
I then save the PDF file to a location on the webserver and return the file name from the web service, and the AJAX page opens a new window with the pdf file.
So far, it works well, however, there is one part of my AJAX page that I want to printout and I haven't come up with a solution for yet. I've got a string of the HTML content of a TinyMCE editor that I want to dispay in the bottom part of the PDF page.
I'm looking for some sort of tool I could use for this purpose. Even something opensource that prints to GDI+ I could use by taking the source code and translating it to use PdfSharp's GDI+ (the class names are like XGraphics, with each class having X before the GDI+ name).
If I have to I will limit what HTML can be generated by TinyMCE and write my own renderer, but that will be a big challenge, so I'm looking for other solutions first.
I've stayed away from a printer-friendly page approach because I wanted to construct a page that was a near identical of an existing WinForms printout, using my existing code. With PdfSharp I was able to convert all the code except the text area stuff (which used the RichTextBox and RTF in the WinForms version).
Tony,
I personally have used WebSupergoo's ABCPdf library with much success. You can actually render HTML directly to the PDF and it does fairly well in regards to accuracy.
Another free software that will allow you the flexibility of writing HTML to PDF that I have used in the past with much success is iTextSharp.
Otherwise, I think you'll have to write something to render HTML to GDI.
Either way, you may want to consider using an HttpHandler that you map to using your web.config to generate the PDF file. This will allow for you to render the PDF to a bytestream and then dump it directly to the user (as opposed to having to save each PDF receipt to the web server). It will also allow for you to use the .pdf extension in the page that returns the receipt (PurchaseReceipt.pdf could be mapped to a HttpHandler)... making it more cross-browser friendly. Older versions of Adobe / Browsers will not display correctly if you start throwing a PDF byte stream from an ASPX page.
Hope this helps.