How to parsing HTML content at MFC, C++ - html

I am a newbie working on MFC, C++,
Main works is load html file and display every content at MFC dialog.
When we click Hyperlink on dialog , it create new dialog/window to display file content(pdf) using window default assignment.
Is there any way that support extracts html content and write to MFC dialog?
If we do not use "Navigate"?
Thanks in advance.

You can do that with CHtmlView. Call Navigate() to start page loading and parse inside OnDocumentComplete. I'm sure you will find tons of examples on the Internet.

Related

Is there a way to access the HTML of an In App Browser (Themeable Browser)

I am using the ionic framework and would like to be able to read from the HTML from the current webpage and then send the selection back to my application.
I have the Theme-able Browser Plugin setup and can use it like any other web browser.
I have tried looking at ways to include my own script with the .executeScript() function but no luck.
I have also tried to read data from custom buttons that I have inserted into the tool/nav bar but that gives me the HTML of my application.
TL;DR: (Basically want access to the DOM of the current webpage and have the user use native selection to read the document.getSelection() and send that text back to my application.)
Any help would be highly appreciated.
After browsing the forums on Ionic I found the solution:
browser.executeScript({code:'window.getSelection().toString();'}).then((selection)=>{
packet.text = selection[0];});
This allows me to get the selection.

Edit Content of website without opening HTML file

is there some other way to edit or change some text or pictures on my website using it's interface or not from the HTML file, cause my client is wondering on how can day update the "Events" Box(they don't know how to use HTML) i'm really new at this and open to any suggestions, thank you
It depends on what you are using. if you are using a CMS based program that would be possible.
you cannot edit a page without opening its files right of the browser without any external help.
It seems that you want to edit the content of your website. Yes, its possible without opening any file using your CMS Dashboard. If the content is static then you have to open the php/html file.

Save Rendered HTML to Image in Golang with Templating

I need to be able to build an html page and then save the rendered html output to an image. Before I switched to Go, I was accomplishing this with NodeJS and PhantomJS by building a "headless" webpage and capturing the image with a screenshot into an image file. I need to be able to do the same thing in Go. I know how to build the HTML template using the html/template package. But, I am lost on how I get essentially capture a screenshot of the rendered HTML and save it to an image with a specified width and height. This was fairly easy in PhantomJS by just calling the 'Render' method and passing the location of the image to save to. But, I can't find anyway to do this in Go.
Any help is greatly appreciated!

Is it possible load a cshtml file in an iframe on non-cshtml page?

I'm working on an outlook 365 app for the web client of outlook. In outlook, you can define a button above the email that opens a panel when clicked. This panel is basically and iframe. The issue is, I need to point that frame at a cshtml file, which you can't do unless the page the iframe is on is also a cshtml file from what I understand.
My question is though, is there a way to load a cshtml file in an iframe on a page that is just a regular, plain html file? If the answer is no, as I suspect it is, is there a different way of doing this or is there a way to get around this?
I've searched high and low on google to try and even find an answer and there is nothing.
You can call the cshtml view through the asp.net routing
<iframe src="/controller/Action"></iframe>
if you want to be able to call views without calling actions
you need to override HandleUnknownAction
https://stackoverflow.com/a/8372820/1551411

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.