html-to-pdf

MPDF not supporting image/icon rotation

风流意气都作罢 提交于 2020-01-06 04:52:24
问题 I would like to generate a PDF from my HTML script.Now the script is <?php require_once __DIR__ . '/vendor/autoload.php'; $mpdf = new \Mpdf\Mpdf(); $mpdf->WriteHTML('<div class="pageContatiner noSelect ui-droppable slctCon"><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-1" class="shape obj" style="width: 136.217px; height: 136.217px; position: absolute; transform: matrix(-0.491017, -0.87115, 0.87115, -0.491017, 0, 0); margin-left: 312px; margin-top: 99px;" x

iTextPdf 5.5.1 - Converting large HTML to single Page PDF with Custom fonts

纵然是瞬间 提交于 2020-01-03 06:05:13
问题 I am having HTML document including CSS Styles. I want to create one pdf file with custom fonts and the height as per the document contents. I followed this implementations Adjust page size based on amount of HTML data But it wants separate HTML and CSS. I provide it whole document string as HTML and left the CSS String null. It gave me exception. Moreover if there is any examples to implement custom fonts in Java Please help. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:/

iTextSharp XmlWorker: right-to-left

元气小坏坏 提交于 2019-12-24 01:53:52
问题 After a long time of struggling with this not-so-friendly API, I am finally making progress, but now I've come to a really nasty issue.. I have placed "dir" attributes in various places in my html with the value being "rtl".. but the XMLWorker doesn't seem to respect that at all. Does anyone know of a workaround? Here's my method: public static void Generate<TModel>(string templateFile, TModel model, string outputFile, IEnumerable<string> fonts) { string template = System.IO.File.ReadAllText

iTextSharp MVC View to PDF

拈花ヽ惹草 提交于 2019-12-23 05:29:05
问题 I'm having a little trouble with my TextReader when trying to parse the html string I want to convert to PDF when using iTextSharp. Function ViewDeliveryNote(ByVal id As Integer) As FileStreamResult 'Memory buffer Dim ms As MemoryStream = New MemoryStream() 'the document Dim document As Document = New Document(PageSize.A4) 'the pdf writer PdfWriter.GetInstance(document, ms) Dim wc As WebClient = New WebClient Dim htmlText As String = wc.DownloadString("http://localhost:59800/Warehouse

Stack empty Error when using iTextSharp for converting HTML to PDF

空扰寡人 提交于 2019-12-23 04:52:27
问题 I want to export in pdf my htmlcode var document = new Document(); string filePath = Server.MapPath("~/generatedBook"); string exceptionPath = Server.MapPath("~/exceptions"); PdfWriter pdfWriter = PdfWriter.GetInstance(document, new FileStream(filePath + "/Book"+_IdSes+".pdf", FileMode.Create)); pdfWriter.SetFullCompression(); pdfWriter.StrictImageSequence = true; pdfWriter.SetLinearPageMode(); try { document.SetPageSize(PageSize.A4.Rotate()); document.SetPageSize(new Rectangle(792f, 612f));

.NET version or port of Flying Saucer

可紊 提交于 2019-12-22 04:26:11
问题 Is there any open source .NET project (or port) similar to the Flying Saucer project which renders HTML to PDF using iText? 回答1: I always recommend wkHTMLtoPDF for web->PDF conversions. It's web kit based though I'm not sure what PDF library it's sitting on. At any rate, you'll be hard pressed to find something that will render your HTML more accurately (it'll even run script, set innerHtml and so forth). 回答2: For a quick-and-dirty solution you could try using IKVM to compile the Java to .NET

iTextSharp add ( css style or a css file) and download pdf file

核能气质少年 提交于 2019-12-18 09:46:30
问题 Finally got it working var inputString = @"<html> <body> <table class='table-bordered'> <thead> <tr> <th>Customer Name</th> <th>Customer's Address</th> </tr> </thead> <tbody> <tr> <td> XYZ </td> <td> Bhubaneswar </td> </tr> <tr> <td> MNP </td> <td> Cuttack </td> </tr> </tbody> </table> </body> </html>"; List<string> cssFiles = new List<string>(); cssFiles.Add(@"/Content/bootstrap.css"); var output = new MemoryStream(); var input = new MemoryStream(Encoding.UTF8.GetBytes(inputString)); var

Python3 Django -> HTML to PDF

a 夏天 提交于 2019-12-18 01:04:44
问题 There are a lot of different ways of generating pdfs from a django webpage in python2. The most clean, probably, is pisa and reportlab. These do not work for python3 though. So far, the only method I've had success with is to render the template, write it to a file, and then use wkhtmltopdf via subprocess.popen. This works alright, but it doesn't load any of my static files, such as css and images. Are there any proper solutions? can wkhtmltopdf read my staticfiles from the command line, in

Convert HTML to PDF in MVC with iTextSharp in MVC Razor

℡╲_俬逩灬. 提交于 2019-12-17 10:30:52
问题 I am trying to convert HTML to PDF with iTextSharp in MVC Razor, but everything I have tried has not worked. Does anyone know how to accomplish this? 回答1: There's a detailed and step-by-step tutorial on CodeProject you might follow. It illustrates how you could serve an ASP.NET MVC View as PDF file using iTextSharp for the conversion. Bear in mind though that iTextSharp was not meant for converting HTML to PDF so it might not cope very well with complex HTML pages and CSS styles. 回答2: Here is

iText 7 accessible PDFs from HTML: how do I avoid table tag when using display: table;

谁说胖子不能爱 提交于 2019-12-13 13:15:54
问题 I am working on an ASP.NET MVC project which converts a view to a PDF. Previously, Rotavia was used, but then a new client requirement is that the PDF be accessible/508-compliant. For layout purposes, the previous developer had a whole header section (logo, title, disclaimer, etc) as a table without th elements (just td). I needed to convert them to divs but keep the look the same. So, what I did was made them divs and then used the CSS properties, display: table, display: table-row-group,