itext

PdfDocument to byte[] using PdfMerger iText7

拈花ヽ惹草 提交于 2020-07-31 04:16:31
问题 I've a requirement, where I am generating different pdf' using iText 7.1.11 . I am using PdfMerger to merge all pdf's on the fly. I am able to generate pdf successfully at my local system, but the application needs to send bye[] in response. The solution I found here and here . but the problem is PdfMerger does not accept Document object, and I am not sure if i revert my code to use Document instead of PdfDocument will it work or not. Below is the code, with what I tried. public static void

动态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

Exception referring # START NON-TRANSLATABLE while working with java itext and IBM i RPG ILE

为君一笑 提交于 2020-07-23 07:11:27
问题 working with java itext library, with a very simple test. Code passes but when closing document, it fails due to null pointer exception with java.lang.String.compareToIgnoreCase. It happens while embedding itext java code into IBM i RPGIV code. Not sure yet if it is a JNI/RPGIV conversion problem (utf8 should be converted to EBCDIC native charset) or a proper itext issue. It would help if any itext developer could confirm me if it could be a typical itext issue or not sounds like that,

Exception referring # START NON-TRANSLATABLE while working with java itext and IBM i RPG ILE

我怕爱的太早我们不能终老 提交于 2020-07-23 07:10:26
问题 working with java itext library, with a very simple test. Code passes but when closing document, it fails due to null pointer exception with java.lang.String.compareToIgnoreCase. It happens while embedding itext java code into IBM i RPGIV code. Not sure yet if it is a JNI/RPGIV conversion problem (utf8 should be converted to EBCDIC native charset) or a proper itext issue. It would help if any itext developer could confirm me if it could be a typical itext issue or not sounds like that,

Itext PDF do not display correctly Myanmar Unicode Font

只愿长相守 提交于 2020-07-18 17:27:13
问题 Itext 5 do not display correctly at generated pdf file for Myanmar Unicode fonts. Itext version : 5.5.13.1 Expectation Result : သီဟိုဠ်မှ ဉာဏ်ကြီးရှင်သည်အာယုဝဎ္ဍနဆေးညွှန်းစာကို ဇလွန်ဈေးဘေးဗာဒံပင်ထက် အဓိဋ္ဌာန်လျက် ဂဃနဏဖတ်ခဲ့သည်။ Actual Result : Google Drive Link for generated PDF. My test string is similar with "The quick brown fox jump over the lazy dog" in English. It contains most of Myanmar alphabets. Java program that I used to product above pdf String fileName = "sample.pdf";

How to embed font in PDF created from HTML with iText and Flying Saucer?

谁说胖子不能爱 提交于 2020-07-17 09:52:26
问题 I have problem with embedding Polish fonts into PDF converted from HTML. My HTML code have style in body: <BODY style="font-family: Tahoma, Arial, sans-serif;font-size : 8pt;"> I tried 2 ways of converting such HTML into PDF: FOP with htmlcleaner iText with flying-saucer For FOP I can add all used fonts into its config file and then created PDF have those fonts embedded (if font is used in HTML). In resulting PDF I have Tahoma font in Identity-H encoding. It looks good -- all Polish letters

How to embed font in PDF created from HTML with iText and Flying Saucer?

烈酒焚心 提交于 2020-07-17 09:52:23
问题 I have problem with embedding Polish fonts into PDF converted from HTML. My HTML code have style in body: <BODY style="font-family: Tahoma, Arial, sans-serif;font-size : 8pt;"> I tried 2 ways of converting such HTML into PDF: FOP with htmlcleaner iText with flying-saucer For FOP I can add all used fonts into its config file and then created PDF have those fonts embedded (if font is used in HTML). In resulting PDF I have Tahoma font in Identity-H encoding. It looks good -- all Polish letters

C# Verifying PDF signature

只谈情不闲聊 提交于 2020-07-08 03:05:27
问题 Trying to validate PDF signature isn't working. The PDF were signed by Adobe Acrobat and then trying to verify it with the public key of the client certificate. So I get the public key of the client certificate, hash the PDF and verify if the hash is equal to the pdf signature, but it fails. HttpClientCertificate cert = request.ClientCertificate; X509Certificate2 cert2 = new X509Certificate2(cert.Certificate); PdfReader pdfreader = new PdfReader("path_to_file"); AcroFields fields = pdfreader

C# Verifying PDF signature

风流意气都作罢 提交于 2020-07-08 03:05:11
问题 Trying to validate PDF signature isn't working. The PDF were signed by Adobe Acrobat and then trying to verify it with the public key of the client certificate. So I get the public key of the client certificate, hash the PDF and verify if the hash is equal to the pdf signature, but it fails. HttpClientCertificate cert = request.ClientCertificate; X509Certificate2 cert2 = new X509Certificate2(cert.Certificate); PdfReader pdfreader = new PdfReader("path_to_file"); AcroFields fields = pdfreader

iText7 Create PDF in memory instead of physical file

六月ゝ 毕业季﹏ 提交于 2020-07-06 13:52:07
问题 How do one create PDF in memorystream instead of physical file using itext7? I have no idea how to do it in the latest version, any help? I tried the following code, but pdfSM is not properly populated: string filePath = "./abc.pdf"; MemoryStream pdfSM = new ByteArrayOutputStream(); PdfDocument doc = new PdfDocument(new PdfReader(filePath), new PdfWriter(pdfSM)); ....... doc.close(); The full testing code as below for your reference, it worked when past filePath into PdfWriter but not for the