pdf-generation

Which one is the best PDF-API for PHP? [closed]

微笑、不失礼 提交于 2019-11-26 11:03:33
Which one of these is the best PDF-API for PHP? ApacheFOP dompdf FPDF html2ps mPDF PDFlib TCPDF wkhtmltopdf Zend_Pdf personally i'd rather go with tcpdf which is an ehnanced and mantained version of fpdf. From the mpdf site: "mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML. It is based on FPDF and HTML2FPDF, with a number of enhancements." mpdf is superior to FPDF for language handling and UTF-8 support. For CJK support it not only supports font embedding, but font subsetting (so your CJK PDFs are not oversized). TCPDF and FPDF have nothing on the UTF-8 and Font support

How to render an ASP.NET MVC View in PDF format

感情迁移 提交于 2019-11-26 10:17:49
问题 I\'m working with ExpertPDF\'s Html-to-PDF conversion utility for this question (although I\'m open to other libraries if there\'s sufficient documentation). In short, I have a view that is formatted a specific way and I would like to render it as a PDF document the user can save to disk. What I have so far is a PrintService (which implements an IPrintService interface) and this implementation has two overloads for PrintToPDF(), one that takes just a URL and another that takes an HTML string,

How to implement custom fonts in TCPDF

戏子无情 提交于 2019-11-26 08:20:45
问题 In TCPDF, there are only a few fonts to choose from, to create pdf files. I want to set Tahoma as my pdf font. How can I include Tahoma in TCPDF?? 回答1: The latest TCPDF version automatically convert fonts into TCPDF format using the addTTFfont() method. For example: // convert TTF font to TCPDF format and store it on the fonts folder $fontname = TCPDF_FONTS::addTTFfont('/path-to-font/FreeSerifItalic.ttf', 'TrueTypeUnicode', '', 96); // use the font $pdf->SetFont($fontname, '', 14, '', false);

Embedding SVG in PDF (exporting SVG to PDF using JS)

老子叫甜甜 提交于 2019-11-26 08:06:16
问题 The starting points: I don\'t have a server that can provide anything but static files. And I have an SVG element (dynamically created) in my <body> that I want to export to a vector format, preferrably PDF or SVG. I started looking at using the already existing lib jsPDF along with downloadify. It worked fine. Unfortunately, this does not support SVG, only text. I\'ve read about the PDF format\'s possiblities to embed SVG images, and it seems to have been enabled since Acrobat Reader 5

How to convert/save d3.js graph to pdf/jpeg

一笑奈何 提交于 2019-11-26 07:29:36
问题 I\'m working on a client-side/javascript function to save or convert an existing D3-SVG graph into a file. I\'ve searched a lot and found some recommendations, mainly using canvas.toDataURL() . I have no <canvas> in my page, and instead using: d3.select(\"body\").append(\"svg\").... I\'ve also tried to append the SVG to the <canvas> but nothing happens. Could you please help me to resolve this exception: Uncaught TypeError: Object #<SVGSVGElement> has no method \'toDataURL\' Thank you 回答1: As

jsPDF can&#39;t get any styling to work

女生的网名这么多〃 提交于 2019-11-26 06:39:34
问题 I\'m new to using jsPDF but and for the life of me I can\'t get any css to apply to this thing! I\'ve tried inline, internal, and external all to no avail! I read in another SO post that since it\'s technically printing stuff to a file I need a print style sheet, and that didn\'t work either. I have a very basic page that I\'m just trying to get any CSS to work with: JS: <script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"></script> <script type=\"text/javascript\" src=

How to merge documents correctly?

浪子不回头ぞ 提交于 2019-11-26 06:08:17
问题 I have the following problem when printing the pdf file after merge, the pdf documents get cut off. Sometimes this happens because the documents aren\'t 8.5 x 11 they might be like 11 x 17. Can we make it detect the page size and then use that same page size for those documents? Or, if not, is it possible to have it fit to page? Following is the code: package com.sumit.program; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io

Converting HTML files to PDF [closed]

☆樱花仙子☆ 提交于 2019-11-26 05:40:55
问题 I need to automatically generate a PDF file from an exisiting (X)HTML-document. The input files (reports) use a rather simple, table-based layout, so support for really fancy JavaScript/CSS stuff is probably not needed. As I am used to working in Java, a solution that can easily be used in a java-project is preferable. It only needs to work on windows systems, though. One way to do it that is feasable, but does not produce good quality output (at least out of the box) is using CSS2XSLFO, and

Convert canvas to PDF

独自空忆成欢 提交于 2019-11-26 05:20:28
问题 Is it possible to directly convert canvas to pdf using JavaScript (pdf.js or something like that)? Is there another possible way like canvas to img and then img to pdf? Can you give me an example? 回答1: You can achieve this by utilizing the jsPDF library and the toDataURL function. I made a little demonstration: var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); // draw a blue cloud context.beginPath(); context.moveTo(170, 80); context.bezierCurveTo(130,

Render HTML to PDF in Django site

久未见 提交于 2019-11-26 03:46:21
问题 For my django powered site, I am looking for an easy solution to convert dynamic html pages to pdf. Pages include HTML and charts from Google visualization API (which is javascript based, yet including those graphs is a must). 回答1: Try the solution from Reportlab. Download it and install it as usual with python setup.py install You will also need to install the following modules: xhtml2pdf, html5lib, pypdf with easy_install. Here is an usage example: First define this function: import