How to open a webview in reading view ? UWP - c#

I have a FeedReader app and I would like my pages open in reading view ( feature from IE 11 , EDGE ) .as an example The news app in windows 10 uses this feature and all news descriptions are in reading view . is it possible ?
Reading View example (Screenshot) :
https://social.msdn.microsoft.com/Forums/getfile/733596
News app reading view example (Screenshot) :
https://social.msdn.microsoft.com/Forums/getfile/733599
Thanks in advance .

In these cases the content of the web page is extracted and shown with custom styling.
To get the same result you can use something like DIFFBOT (which I think is used in the News app) or Embedly which is cheaper, and get the content parsed and returned nice and structured. After that you'll have to style it yourself.
You can style it by "converting" it from HTML and show it in a TextBlock, or you can show it in a WebView.
EDIT:
You can use something like HtmlUtilities.ConvertToText to get the text from the HTML. I think you can convert one section at a time, that way you can style headers and such.

Related

c# add page to onenote from template

New to OneNote development. I have an app that I want to add a new page based on the template that is the default in this section of my notebook.
I want to take some text from a textbox and name the generated new page to that text. I don't need to do anything else with the page from the app Any ideas would be much appreciated.
You can use the Onenote API to programmatically recall the template page's content as html See http://dev.onenote.com/docs#/reference/get-pages/v10menotespagesidcontentincludeids on how to do this.
Once you have the template's html, you can make the title tag with the title you get from your web form . eg: my title and make a POST request to the section. See http://dev.onenote.com/docs#/reference/post-pages/v10menotessectionsidpages
That should take care of it.

Check if (mobile)browser support background images

I am building a mobile site and the footer has an background.
I want to check if the browser supports css property, background-image, if true display background with specific html, else display a different set of html.
I am using the following :
HttpBrowserCapabilities bc = new HttpBrowserCapabilities();
I can't seem to get a check for backgrounds.
The reason why I want to check for BG-image support is coz I have to switch between 2 sets of html. 1 with html text and bg image, and the other with the text on the image - sliced for each word/link...to give the same effect.
to get information by HttpBrowserCapabilities, you have to use Request.Browser property.
HttpBrowserCapabilities browerCapabilities = Request.Browser;
I think Asp.net will automatically check the type of the browser and render the page accordingly. So if the the browser don't support background images it will not come.
Another idea to solve the issue is getting the browser type by using code, then you can show or hide the background images based on the type.

taking a screenshot of some element in the html

So I was wondering, if I have a div which contains a maps of google maps rendered with some makers and I want to take a picture of that element how can I do this?.I found this solutions it's a approach of what I need but the problem it's that sending a url doesn't help me, I need the specific Div with all the markers. For the server side i'm using C# and for the cliente, asp.net with jquery. Also the google maps apiV3 to handle the maps
Take a look at the Canvas2Image library by Nihilogic Labs:
http://www.nihilogic.dk/labs/canvas2image/
Here's an example of how to take a screenshot of an element through JavaScript:
var oCanvas = document.getElementById("thecanvas");
Canvas2Image.saveAsPNG(oCanvas);
EDIT
You might also take a look at Html2Canvas and FlashCanvas too. I believe one of them has support for earlier browsers (those which don't support HTML5).
Use the method in the link you mentioned and crop the resulting image to the dimensions of your div. You can use myDiv.getBoundingClientRect() in JavaScript to get the dimensions of your div.
Using the WebBrowser control, you can manipulate the document using html or JavaScript to get the page in the state you need to take your screenshot.
Have you considered using the Google Maps Static API - this will render a map image, with markers on it, as a PNG.

ASP.NET Which HTML editor can do everything I want?

I have tried to use the standard AJAX HTMLeditor from here (http://www.asp.net/ajaxlibrary/act.ashx) and I have try to work with the FCKEditor (from http://ckeditor.com/)
But both don't do everything. I call the AJAX standard control A and the FCKeditor F.
With the A editor it is impossible to get your HTML text in the HTML content. You can only get it in the Design content. (this next code doesn't do the job: string htmlContentStr = Editor1.Content).
With F it is possible to get it in the HTML content (it does this by default), but to get your changes back in HTML is impossible. (this next code doesn't do the job: string htmlContentStr = FCKeditor1.Value).
So what I need is a HTML editor that is possible to put HTML text in HTML content, a user can make changes in the designcontent and after the changes 're make it must be possible to get the HTMLcontent and put it away in a string or database.
Is this possible or do I need a commercial one to get this feature?
If my question isn't clear, please let me know.
Thnx
I've used XStandard quite easily and it let me manipulate the HTML. I didn't bother using it as a control, but just read and wrote (escaped) the HTML where needed into the asp output.

c# webbrowser show what you want

i want create small web browser , tiny and fast
but i have problem ,
let me explain :
1 - user enter site : google.com
2 - c# program get google.com
3 - find <td nowrap="" align="center">
4 - in web browser only show that area
i dont know where i must start ,
thanks
Ok, I'm going to try answer your question, but I am deciphering as well.
Create a WebBrowser control on your form. (2.0 is fine for what you need) and .Navigate("http://www.google.com");
Get the source code from the Document. You can do this as follows: string source = _WebBrowser.Document.Body.OuterHtml;
Use string manipulation to get to the area on the page you need. For instance .SubString() functions
Save the text into a file, or stream and load it into the WebBrowser control, or replace the pages Document HTML with just the HTML you are wanting to show.
Okay! Looking at the comment it seems you want to request for a page using c# and show only one part of the page. In your case its that specific <td> . Please correct me if I am wrong.
Other than what Kyle has mentioned. Check out HTML agility Pack. It might be of interest to you.

Categories