As part of an application I am developing, a user can create document templates using HTML (or rather, a web based rich text editor that uses HTML). When the user then saves their template, I want to be able to render this HTML 'in memory' and grab a thumbnail sized screenshot of the output, so the user can see their template looks in a thumbnail.
Is this possible in C#?
Related
I have a functionality where I need to upload a multi-page document. For display purposes, I have to give the user ability to view it page-vise. I have to show no. of pages and then user can navigate back and forth between the pages to view each page.
Any pointers on how this can be accomplished? I am using ASP.Net MVC3 and C# as the language.
Much Thanks!
If by "multi-page document" you mean like a PDF or word doc, then you'll need to embed a 3rd party viewer in your page and have it display. Generally they have the functionality you've mentioned built-in.
i want to generate a PDF file with tables, etc in it. so what i did is using a PDF converter (EVO PDF). that works great, except that the PDF has a white background-color.
What I wanted to do is to overlay a PDF document (because our company paperwork) and put the HTML above it. But because the HTML has a white background, I can't get it work.
I'm now using EVOPDF to generate the HTML and Syncfusion to overlay the company paperwork..
there must be an easier way
Convert the company stationary into a flat image, and then set that as the background to the page in CSS. As long as care is taken to measure and set sizing right, that should work for you.
I have a web app that displays the profile of over 600 people, and each profile displays a word cloud. the word cloud is rendered using html.
The client has requested that the same word cloud to appear in an excel macro that pretty much does the same thing as the web app.
I have seen a few solutions that saves image from rendered page but is there a way to create images from the html programatically, without selecting each of the 600 profiles manually.
Since rendering html is a browser's job, you could take a look at doing it by javascript.
Write a nice little program in jQuery (or your favorite js framework) that renders the word cloud of every profile on a canvas, and then use this:
http://www.nihilogic.dk/labs/canvas2image/
to take an image of the rendered html.
I know it has been a while since I asked this question but I'll answer it for the benefit of others. I ended up using something called IECapt to capture rendering of a web page into a BMP, JPEG or PNG image file;
http://iecapt.sourceforge.net/
I then wrote a unit test to iterate over the various urls, passing it as an argument to the IECapt utility. Was able to render over 600 images in a few seconds.
Is there a way to write PDF to a div from DataBase i.e. Retrieve a Byte[] from Database and Reponse.BinaryWrite to a div.
We do similar thing for Images using src = "anotherpage.aspx" where image is written on anotherpage.
Is it possible with PDF without using IFrame?
If what you're trying to do is show a PDF file inside a DIV, you're going down the wrong path. You either need to:
Convert the PDF to Flash (ala Flash Paper)
or
Convert the PDF to HTML (like Scribd does using HTML 5).
Then you can embed the PDF inside a DIV. But no browser I know of supports directly embedding PDFs.
Otherwise you have to put the PDF in an IFRAME, but how this is shown is PDF plug-in dependent.
No. The reason it works with a src=otherpage.aspx request is that the src attribute results in the user's web browser making a completely separate request for the other resource. You're serving up an additional page to make that happen. Writing a PDF file directly is trying to inject the PDF into the same request as your page - not really "similar" to your img src at all. In fact, what is most similar to the "src=otherpage.aspx" method is the iframe approach that you mentioned.
As a side note, you our "AnotherPage.aspx" example should really be changed to "AnotherPage.ashx". Note the letter 'h' in there. That means you're using a handler rather than a page, which will perform better.
I'm writing a simple textviewer for the famous .nfo files.
For easy layout stuff I'm using the webbrowser control to display the nfo file.
I have font - nonstandard ofcourse - that I'd like to use.
What's the best way to include / link the font in my application ?
Do I have to include it in my application-folder and register it, or is there a way to use a font in my control that's not standard installed ?
The fonts are not part of the web control. The fonts come from the HTML of the web page that you're viewing with the web control.
So, the first step is to make a sample HTML page that displays correctly in a browser (with the fonts you want), then you can load that page into the webcontrol later.
To load fonts in the html page, see: How to embed fonts in HTML?
Once you have that, then the second step is to simply generate the HTML page text dynamically (with the font code in it and your NFO) and then stick that into the WebBrowser control.