Generate PDF file from HTML string in asp.net with vb - asp.net

I want to generate PDF file from HTML string and that PDF file I have to attach in mail using asp.net. I try ghtmldoc.exe, it will generate corrupted pdf file.
I also use iTextsharp. It generate PDF without format though I don't use CSS in that HTML page. Only data in html file is converted in PDF.

I've always found Winnovative HTML to PDF converter very useful for doing things like this:
http://www.winnovative-software.com/Html-To-Pdf-Converter.aspx
You can either specify a URL to convert to PDF, or specify a HTML string to convert to PDF instead.
An open source solution, would be iTextSharp:
http://sourceforge.net/projects/itextsharp/

Exporting to pdf is really made simple by telerik. check this link. Telerik has a good look too. so if you are not late to change over to telerik, i suggest do that.

Related

Is it possible to convert an html page to a pdf with asp.net?

I want to generate pdf of my webpage. Is it possible? if not then what can be done to get a pdf form which has the data from the database.
Depending on what you need this for, you can create a PDF via the Print menu in Chrome (Save to PDF is a "printer").

How to convert a html table to downloadable excel file ASP.NET C#

I need a function to convert any HTML table to a excel file!
I like to add a button to my page and once that button is clicked I pass a complete HTML table in to such a function that will generate an excel file and past the html table into the file with the same layout and design!
I appreciate any help with this request.
I am using c# and asp.net
This is a nasty trick, but it works in recent version of excel.
You just save the html table as a normal html file, then just rename it to xls. If your application is a web application use response.setHeader("Content-Disposition", "attachment; filename=order.xls").
Recent version of excel support Microsoft Office XML Formats, so if the previous solution doesn't work, you may want to try to generate the xml from the html table.
See XML Spreadsheet Reference.
What I do, is to generate the xml from excel in the xml format, then hack into it. You can implement also advanced features like automatic filters, and cool layouts. I used a template engine to generate the xml (Freemarker, it's Java stuff, but I'm sure there are template engines also for .NET)

A "shortcut" method for exporting an ASP.Net Page to pdf/xls

I want to export a few Pages to pdf/xls. By Pages I mean as the eye sees it - a screenshot of the Page's contents. I know how to build pdf/xls documents using 3rd party tools but is there any way to quickly export the rendered contents of say a Panel?
edit: maybe a tool that can render the page's output as a browser would, and save it as an image file?
There is an open source console program named wkhtmltopdf which you could call from asp.net to convert the page. It can convert to PDF or an image with wkhtmltoimage (JPG, PNG, etc.) using the webkit rendering engine.
Check my answer to this question to see an example of how to convert from a html to a pdf using C#:
Easiest way of porting html table data to readable document
I can recommend http://www.screengrab.org/ for firefox.

Embed image in word file using ASP

Does any body have any idea how to embed picture in word file created with ASP Classic?
I had to generate Word files with ASP once, by far the easiest way (and you can get it looking pretty good this way) is to render an HTML file with your desired content and do it that way. I can't remember if renaming the HTML file to .doc worked, or if I used a component. But HTML is probably the way to go.

Using PDF In .Net App

Can someone point me to some code/tutorial on how to upload pdf files and store them, then moreover how to use a pdf reader to display the file as read only in an asp.net application.
Is there a PDF reader already in the visual studio toolbox?
The approach I would use in this situation is to upload the PDF as you would any other file, then use a tool like GhostScript to convert the PDF pages into image files that you can show in ASP .Net.
Here's a tutorial doing that in C# http://www.codeproject.com/KB/cs/GhostScriptUseWithCSharp.aspx
Adobe provides (on acrobat.com) a free service which provides you with the ability to upload pdf (and also other types like doc...) and then embed a nice flash interface for displaying the files on your page.
It's pretty helpful as you can store some 5 gigs of files here.
But if you want to let the users upload their own files then this won't help you.
PDF is a final format file, ie its is read-only for the most part and can be embedded into the page via the <object> tag, except if you mean downloadable by the user.
Displaying PDF is generally done by rasterising to an image format for display (ie as an image on the page or via a richer interface (with zooming etc) through flash/silverlight etc.
You can use [GhostScript][1] to interpret PDF files and convert them to an image.
[1]: http://www.GhostScript .com
Uploading a PDF is just like any other file. Use the ASP.NET file uploader control:
http://www.codeproject.com/KB/aspnet/fileupload.aspx
In order to view the PDF in an ASP.NET application, you could either depend on Acrobat being there or use a PDF Viewer control.
The company I work for, Atalasoft, sells a PDF Reader add-on to our web viewer controls. You can learn more here: http://www.atalasoft.com/products/dotimage/pdf-reader

Resources