itext

How to set the paragraph of itext pdf file as rectangle with background color in Java

ぃ、小莉子 提交于 2020-01-21 08:31:52
问题 I am designing a pdf report using itext library.I have implemented a paragraph in it.Now as per my requirement i have to set this paragraph inside rectangular box with background color but i am not able to do it.. Here is my Itext code in java... Font f = new Font(FontFamily.TIMES_ROMAN, 25.0f, Font.BOLD, BaseColor.CYAN); Paragraph p = new Paragraph("Total Cost:" + dbsumcallcost, f); document.add(p); Please guys help me. Thanks in advance.. 回答1: You need a Chunk to do that: Font f = new Font

display pdf in browser using itext

僤鯓⒐⒋嵵緔 提交于 2020-01-17 15:43:37
问题 i have modify a pdf with itext using pdfstamper. my application now create and save a new pdf file. i want to dipslay the pdf directly in the browser. Here my actual code public static void test07(){ try{ PdfReader reader = new PdfReader("c:\\temp\\file.pdf"); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("c:\\temp\\new.pdf")); AcroFields form = stamper.getAcroFields(); //fill the fields stamper.close(); reader.close(); } catch (Exception e){ e.printStackTrace(); } } The

display pdf in browser using itext

余生颓废 提交于 2020-01-17 15:41:07
问题 i have modify a pdf with itext using pdfstamper. my application now create and save a new pdf file. i want to dipslay the pdf directly in the browser. Here my actual code public static void test07(){ try{ PdfReader reader = new PdfReader("c:\\temp\\file.pdf"); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("c:\\temp\\new.pdf")); AcroFields form = stamper.getAcroFields(); //fill the fields stamper.close(); reader.close(); } catch (Exception e){ e.printStackTrace(); } } The

Creating table in pdf on last page bottom (wrong official solution)

瘦欲@ 提交于 2020-01-17 13:21:07
问题 This is official iText solution for creating a table on the last page at the bottom in pdf document. This solution puts my table at the bottom of the last pdf page. Great. Unfortunately, it causes getting my table more narrow too. And this is what I don't want. I have tried several hours to get that table wider again, but without success. I cannot resolve it. How to put table at the bottom in original size before moving? What is the best solution of this problem? Picture of the problem Before

extract text with custom font result non readble

隐身守侯 提交于 2020-01-17 06:16:07
问题 I need to extect text from pdf with custom fonts but custom don't let to copy/paste text or search text or extract text in a clear/readble way by iText lib... the resultant text is space or non uman readable chars The pdf format are: Author: User Creator: Compart Docponent API Producer: Compart MFFPDF I/O Filter 2013-03-09 00:51:11 CreationDate: 04/21/16 11:26:59 ModDate: 06/09/16 10:02:16 Tagged: no Form: none Pages: 6 Encrypted: no Page size: 595.2 x 841.92 pts (A4) (rotated 0 degrees) File

How to pass custom object in onEndPage() itext method?

和自甴很熟 提交于 2020-01-17 06:04:33
问题 i've some problems with the onEndPage() method (itext), basically i'm already writing some text on footer, with the basc method like this way: public class EventDichiarazionePdf extends PdfPageEventHelper{ private int numPage=0; private static Font h6NormFont = new Font(Font.FontFamily.HELVETICA, 6,Font.NORMAL); public void onStartPage(PdfWriter writer, Document document) { numPage++; } public void onEndPage(PdfWriter writer, Document document) { try { Rectangle page = document.getPageSize();

Reading legacy Word forms checkboxes converted to PDF

独自空忆成欢 提交于 2020-01-17 05:45:21
问题 Our customers sends us orders as PDF forms which is generated from a Word document built with legacy forms. Currently people at our customer center is punching the orders into our system, but we have decided to try and automate this task. I'm able to read the content of the PDF with a simple PdfReader per page: public static string GetPdfText(string path) { var text = string.Empty; using (var reader = new PdfReader(path)) { for (var page = 1; page <= reader.NumberOfPages; page++) { text +=

Error while retrieving images from pdf using Itext

走远了吗. 提交于 2020-01-17 05:33:07
问题 I have an existing PDF from which I want to retrieve images NOTE: In the Documentation, this is the RESULT variable public static final String RESULT = "results/part4/chapter15/Img%s.%s"; I am not getting why this image is needed?I just want to extract the images from my PDF file So Now when I use MyImageRenderListener listener = new MyImageRenderListener(RESULT); I am getting the error: results\part4\chapter15\Img16.jpg (The system cannot find the path specified) This is the code that I am

converting html file containing Chinese character to pdf file using iText. Chinese character not converting properly

无人久伴 提交于 2020-01-17 02:39:45
问题 I have an html file which containing Chinese character. I want to convert HTML file to PDF file. Everything is converting well but Chinese character it showing problem. code are following HTMl file-- <html> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head> <body> chinese---快得利-协议重组贷款 </body> </html> Java file----- package bancmate.reports.otherreports.engreport; import com.lowagie.text.Document; import com.lowagie.text.Element; import com.lowagie.text

converting html file containing Chinese character to pdf file using iText. Chinese character not converting properly

穿精又带淫゛_ 提交于 2020-01-17 02:39:25
问题 I have an html file which containing Chinese character. I want to convert HTML file to PDF file. Everything is converting well but Chinese character it showing problem. code are following HTMl file-- <html> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head> <body> chinese---快得利-协议重组贷款 </body> </html> Java file----- package bancmate.reports.otherreports.engreport; import com.lowagie.text.Document; import com.lowagie.text.Element; import com.lowagie.text