itext

How to bring image to the front(of the text/image) or send the image to the back((of the text/image)) in IText7 using java?

為{幸葍}努か 提交于 2019-12-31 03:40:29
问题 How to bring image to the front(of the text/image) or send the image to the back((of the text/image)) in IText7(7.0.8) using Java? import java.io.FileNotFoundException; import java.io.IOException; import com.itextpdf.io.image.ImageData; import com.itextpdf.io.image.ImageDataFactory; import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfReader; import com.itextpdf.kernel.pdf.PdfResources; import com.itextpdf.kernel.pdf.PdfWriter; import com.itextpdf.kernel.pdf.canvas

How to add external CSS while generating PDF?

廉价感情. 提交于 2019-12-31 03:14:11
问题 Currently i am using following code to generate PDF in a JSP file: response.setContentType("application/force-download"); response.setHeader("Content-Disposition", "attachment;filename=reports.pdf"); Document document = new Document(); document.setPageSize(PageSize.A1); PdfWriter writer = null; writer = PdfWriter.getInstance(document, response.getOutputStream()); document.open(); ByteArrayInputStream bis = new ByteArrayInputStream(htmlSource.toString().getBytes()); XMLWorkerHelper.getInstance

Itext Arabic Font coming as question marks

只谈情不闲聊 提交于 2019-12-31 03:08:04
问题 I am new to iText library. I have a requirement where i need to provide the output as PDF. The pdf has Arabic characters in it. I created a test servlet as given below. public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType ("application/pdf;charset=UTF-8"); Document document = new Document(); try{ PdfWriter.getInstance(document, response.getOutputStream()); // Code 2 document.open(); Font f1; BaseFont bf =

increase width of AcroFields(iTextSharp)

雨燕双飞 提交于 2019-12-31 02:45:07
问题 I'm using iTextSharp to populate the data to PDF Templates, which is created in OpenOffice. it populating fine, I'm getting proper PDF, but some where i want to increase the width of the AcroField. I did below code. it is increasing the width but text is not displaying. AcroFields.Item fldItem = fields.getFieldItem(fieldName); for (int i =0; i < fldItem.size(); ++i) { PdfDictionary widgetDict = fldItem.getWidget(0); PdfArray rectArr = widgetDict.getAsArray(PdfName.RECT); float origX = rectArr

Generate PDF document with Unicode characters using java and itext

一笑奈何 提交于 2019-12-31 01:55:33
问题 I try to adapt a standard code from the itext examples printing some additional Unicode symbols. Although the used font supports these characters, I do not get any result. (the last character "\u2609" is not printed to pdf) Thanks in advance! /* * These examples are written by Bruno Lowagie in the context of an article about fonts. */ package sandbox.fonts.tutorial; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Font; import com

How can I use regular and bold in a single String?

試著忘記壹切 提交于 2019-12-31 00:47:21
问题 I have a String that consists of a constant part and a variable part. I want the variable to be formatted using a regular font within the text paragraph, whereas I want the constant part to be bold. This is my code: String cc_cust_name = request.getParameter("CC_CUST_NAME"); document.add(new Paragraph(" NAME " + cc_cust_name, fontsmallbold)); My code for a cell in a table looks like this: cell1 = new PdfPCell(new Phrase("Date of Birth" + cc_cust_dob ,fontsmallbold)); In both cases, the first

How can I use regular and bold in a single String?

大兔子大兔子 提交于 2019-12-31 00:47:02
问题 I have a String that consists of a constant part and a variable part. I want the variable to be formatted using a regular font within the text paragraph, whereas I want the constant part to be bold. This is my code: String cc_cust_name = request.getParameter("CC_CUST_NAME"); document.add(new Paragraph(" NAME " + cc_cust_name, fontsmallbold)); My code for a cell in a table looks like this: cell1 = new PdfPCell(new Phrase("Date of Birth" + cc_cust_dob ,fontsmallbold)); In both cases, the first

How to generate a valid PDF/A file using iText and XMLWorker (HTML to PDF/A process)

感情迁移 提交于 2019-12-31 00:45:35
问题 I'm currently developing a method that will accept HTML input and convert it into a valid PDF/A file. I know how to programmatically construct a valid PDF/A file using iText (reference: http://itextsupport.com/download/pdfa3.html) but I'm unable to generate a valid PDF/A file using HTML as input and using XMLWorker to transform this input into a PDF file. The problem that I have right now is due to the embedded fonts requirement of the PDF/A format. I always get this exception: Exception in

java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException

こ雲淡風輕ζ 提交于 2019-12-30 17:22:48
问题 I am trying to generate a dynamic PDF file through the following servlet. import java.io.*; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; // Document Object import com.itextpdf.text.Document; //For adding content into PDF document import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfWriter; import com.itextpdf.text.DocumentException; public class

How to convert a PDF generating in response.outputStream to a Base64 encoding

巧了我就是萌 提交于 2019-12-30 15:46:50
问题 I am doing a project where i need to create a admit card for student who are appearing in examination. The pdf Generation part is working fine but my problem is i have to encode my pdf to Base64 format. I am not finding any solution. My code are given as bellow public void downloadPdf() throws IOException, DocumentException { System.out.println("hi i ma in"); resultList=examinationDetailsService.readAdmitCardData(); for(Object[] data:resultList) { personalDetails=(PersonalDetails)data[0];