Tag: html
HTML to PDF
This uses the free and awesome wkhtmltopdf command line tool to convert HTML to PDF, using .NET’s built-in command-line functionality. using System.Diagnostics;using System.IO; class Program{ const string EXE = @”C:\wkhtmltopdf\wkhtmltopdf.exe”; static void Main(string[] args) { string html = “Hello World!”; byte[] pdf = CreatePDF(html); string file = Path.GetTempFileName() + “.pdf”; File.WriteAllBytes(file, pdf); Process.Start(file); } static byte[] CreatePDF(string […]
HTML to Text in ASP.NET
Here’s an easy way to convert HTML to only the plain text, using the NUglify library. View code on GitHub
HTML Line Breaks With CSS
If you have text on the server that may have line breaks, you may have gone through a series of steps to get it to display properly. First, if you weren’t really thinking about it, you just dump the output to the screen. ASP.NET and others HTML encode it, so you generally don’t have to […]