html2pdf

动态jsp页面转PDF输出到页面

强颜欢笑 提交于 2020-07-27 12:52:44
最近工作中遇到不少问题。总结一下。这段代码主要功能是将一个生成JSP页面转发成PDF输出到页面 需要利用ITEXT String html = ServletUtils. forward(request,response, "/WEB-INF/jsp/depot/print/jhd.jsp"); //转发请求到jsp,返回解析之后的内容而不是输出到浏览器 //System.out.println(html); byte[] pdf = PDFUtils. html2pdf(html); response.setContentType( "application/pdf"); response.setHeader( "Content-Length",String. valueOf(pdf. length)); response.setHeader( "Connection", "keep-alive"); response.setHeader( "Accept-Ranges", "none"); response.setHeader( "X-Frame-Options", "DENY"); OutputStream out = response.getOutputStream(); out.write(pdf); out.flush(); public class

HTML2PDF doesn't recognize tables' sizes

筅森魡賤 提交于 2020-05-11 04:56:46
问题 I'm working in a web page developed using Yii Extension and I'm using the HTML2PDF extension to generate PDFs (http://html2pdf.fr/). Though the PDF is generated fine, it doesn't seem to recognize my tables' sizes; doesn't matter the width or height I specify for a row or a whole table: the PDF is always generated the same way (with a table width that just fits the cell content)... Here is how I'm trying to specify the width: <table width="500px" height="20px" style="margin:10px;"> <tr> <td

Sending PDF data via email using PHPMailer and html2pdf

梦想与她 提交于 2020-04-30 06:39:07
问题 Im trying to send PDF or PNG over email and nothing seems to work. Below is my LAST attemnt, I have read every single article here on SO and nothing sees to work what is suggested, can someone please help? I am using PHPMailer, html2pdf and html2canvas, both of those produce proper documents on click, just sending them to php mailer dos not work. I am getting documents that can not be opened... Below are my last attempts... With file_get_contents method i get 0 sized data. PDF attempt: var

How to add padding after page break using html2pdf

半腔热情 提交于 2020-03-25 19:01:28
问题 Converting vue.js html to pdf using html2pdf. Here everything is fine, Only thing i need to add padding-top and padding-bottom after pagebreak elements. Here is code that I tried. var element = document.getElementById('inner'); var opt = { margin: 0, filename: this.auth_user, image: {type: 'jpeg',quality: 0.98}, html2canvas: { scale: 2, bottom: 20 }, pagebreak: { mode: ['css']}, jsPDF: { unit: 'mm', orientation: 'portrait' } }; html2pdf().set(opt).from(element).then(function() { $("#inner")

Having æøå chars in HTML2PDF charset

喜欢而已 提交于 2020-01-31 18:02:30
问题 $content = "ÆØÅ"; $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->writeHTML($content, false) $html2pdf->Output('', 'S')); Gives me a PDF file with "ÆØÃ" I checked the encoding in html2pdf.class.php and it is set to UTF-8 which should be fine. I tried to change 'en' to 'da' (danish), still same result.. How can i fix this please? Spent hours now looking.. 回答1: You have to do two things to see strange UTF8 characters in html2pdf: Set 'UTF-8' encoding , as already suggested by Erik Use

Having æøå chars in HTML2PDF charset

不羁的心 提交于 2020-01-31 18:01:52
问题 $content = "ÆØÅ"; $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->writeHTML($content, false) $html2pdf->Output('', 'S')); Gives me a PDF file with "ÆØÃ" I checked the encoding in html2pdf.class.php and it is set to UTF-8 which should be fine. I tried to change 'en' to 'da' (danish), still same result.. How can i fix this please? Spent hours now looking.. 回答1: You have to do two things to see strange UTF8 characters in html2pdf: Set 'UTF-8' encoding , as already suggested by Erik Use

HTML2PDF Table content is overflowing out of page

浪尽此生 提交于 2020-01-24 12:03:13
问题 I am using HTML2PDF library and I am getting an issue while I am trying to to output my pdf. Actually, my table is always truncated, unable to display the whole content of my table without having it cut. I defined css style, but it seems having to effect.Moreover, If I don't defined into my php script on echo statement table border="1px" it doesn't take style css defined previously. Here my code: <!DOCTYPE html> <html> <head> <title>Test PDF</test> <style> table{width:100%; border-collapse

Converting html 2 pdf (php) using hebrew returns “???”

僤鯓⒐⒋嵵緔 提交于 2020-01-17 07:50:28
问题 I have a using html2pdf library from this link http://html2pdf.fr/en/ and I am trying to get a simple html code into html, the problem is that my text is Hebrew langue and for some reason instead of the text I am getting something like this "???". The same Html code in the browser that set on UTF-8 is working fine ! This is my php code: $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8'); $html2pdf->setDefaultFont('arial'); //add this line $html2pdf->pdf->SetDisplayMode('fullpage');

Converting html 2 pdf (php) using hebrew returns “???”

社会主义新天地 提交于 2020-01-17 07:50:14
问题 I have a using html2pdf library from this link http://html2pdf.fr/en/ and I am trying to get a simple html code into html, the problem is that my text is Hebrew langue and for some reason instead of the text I am getting something like this "???". The same Html code in the browser that set on UTF-8 is working fine ! This is my php code: $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8'); $html2pdf->setDefaultFont('arial'); //add this line $html2pdf->pdf->SetDisplayMode('fullpage');

HTML2PDF support for japanese language(utf8) is not working

随声附和 提交于 2020-01-15 10:59:08
问题 For report generation in PHP I am using HTML2PDF. It works fine with English language but not giving proper output for Japanese language. How can I set utg8 character in hHTML2PDF library. Is there a way to achieve this in HTML2PDF library. I am gettign output like "???????????????" instead of Japanese text In /var/www/html/html2pdf/locale folder following files I found en.csv, fr.cvs, cs.csv, da.csv Can we get such file for Japanese too. Below is my code <?php $content = ob_get_clean(); //