itextpdf

Showing image on a acro text field position

时光怂恿深爱的人放手 提交于 2019-12-08 18:46:30
I had a PDF document which has acro text fields which is already shared to the client. Now the client wants to insert signature image in one of the text fields. My manager asked me to try a way to do the same.My idea is to replace an image on top of the text field position and resize the text field as image size. For replacing acro text field of pdf into image, i am trying as below 1.Finding the text field by its field id String position = null; List<FieldPosition> fieldPositons = form.getFieldPositions("50106"); for (FieldPosition position :fieldPositons) { this.position = position.position;

Why do I get a message saying 1.not.found.as.a.resource?

无人久伴 提交于 2019-12-08 09:23:31
问题 What might cause new Font(Font.HELVETICA, 11f, Font.BOLD) or BaseFont.createFont(BaseFont.HELVETICA, 'Cp1252', BaseFont.NOT_EMBEDDED) to start returning the following?? com.itextpdf.text.DocumentException: No message found for 1.not.found.as.resource itext 5.5.6 jar on Max OSX 10.10 回答1: It seems that you are not using the "pre-canned" jar, but that you have created your own jar. That self-made jar only contains the Java class files. It misses resources such as the language ( .lng ) and the

iText PDF body content Overlapping on Footer part

只愿长相守 提交于 2019-12-08 06:37:35
问题 I use itextpdf-5.5.3 version. When I generate PDF and use PdfPTable it overlapped on Footer part. Some Code for PDF. writer=PdfWriter.getInstance(document, out); document.setPageSize(PageSize.A4); document.setMargins(50, 45, 50, 40); document.setMarginMirroring(false); writer.setPageEvent(new HeaderAndFooter()); document.open(); For Footer, public class HeaderAndFooter extends PdfPageEventHelper { private Font footerFont; public HeaderAndFooter() { super(); footerFont = getFontObj(BaseColor

iTextPdf HTML to PDF : how to render HTML at specific location in PDF

不羁的心 提交于 2019-12-08 04:58:48
问题 I have below HTML string : <font size="5">Requirements:</font><br><ul><li>Bullets are helpful</li><li>to display key points</li></ul><br> How can I render above HTML into PDF at specific location? I have checked some examples at http://itextpdf.com/sandbox/xmlworker but no where mentioned about this. 回答1: Your question isn't a duplicate, but it is related to these questions: underline portion of text using iTextSharp How to adjust the page height to the content height? In both cases, we parse

How to convert image file to a pdf file in Android

血红的双手。 提交于 2019-12-08 02:26:56
问题 I am trying to convert image file (jpeg) in to pdf file in my Adroid application. I have used itextpdf jar and droidtext jar. Neither work for me. Below is the code while using itextpdf . Document document = new Document(); String directoryPath = Environment.getExternalStorageDirectory().toString(); File newPdfFile = new File(directoryPath, "textview8.pdf"); FileOutputStream fileOutputStream = null; try { fileOutputStream = new FileOutputStream(newPdfFile); } catch (FileNotFoundException fnfe

iTextPdf HTML to PDF : how to render HTML at specific location in PDF

三世轮回 提交于 2019-12-08 01:59:23
I have below HTML string : <font size="5">Requirements:</font><br><ul><li>Bullets are helpful</li><li>to display key points</li></ul><br> How can I render above HTML into PDF at specific location? I have checked some examples at http://itextpdf.com/sandbox/xmlworker but no where mentioned about this. Bruno Lowagie Your question isn't a duplicate, but it is related to these questions: underline portion of text using iTextSharp How to adjust the page height to the content height? In both cases, we parse the HTML to an ElementList : ElementList elements = XMLWorkerHelper.parseToElementList(HTML,

Load Font from /WEB-INF/resources/fonts/foobar.ttf with iTextPdf FontFactory

梦想的初衷 提交于 2019-12-07 09:56:56
问题 The question pretty much says it all. I get following exception: ExceptionConverter: java.io.IOException: /fonts/CALIBRI.TTF not found as file or resource. Caused By: java.io.IOException: /fonts/CALIBRI.TTF not found as file or resource. at com.itextpdf.text.io.RandomAccessSourceFactory.createByReadingToMemory(RandomAccessSourceFactory.java:263) at com.itextpdf.text.io.RandomAccessSourceFactory.createBestSource(RandomAccessSourceFactory.java:173) at com.itextpdf.text.pdf

How to convert image file to a pdf file in Android

瘦欲@ 提交于 2019-12-06 05:00:52
I am trying to convert image file (jpeg) in to pdf file in my Adroid application. I have used itextpdf jar and droidtext jar. Neither work for me. Below is the code while using itextpdf . Document document = new Document(); String directoryPath = Environment.getExternalStorageDirectory().toString(); File newPdfFile = new File(directoryPath, "textview8.pdf"); FileOutputStream fileOutputStream = null; try { fileOutputStream = new FileOutputStream(newPdfFile); } catch (FileNotFoundException fnfe) { Log.w(TAG, "# Exception caz of fileOutputStream : " + fnfe); } BufferedOutputStream

Load Font from /WEB-INF/resources/fonts/foobar.ttf with iTextPdf FontFactory

回眸只為那壹抹淺笑 提交于 2019-12-05 16:31:25
The question pretty much says it all. I get following exception: ExceptionConverter: java.io.IOException: /fonts/CALIBRI.TTF not found as file or resource. Caused By: java.io.IOException: /fonts/CALIBRI.TTF not found as file or resource. at com.itextpdf.text.io.RandomAccessSourceFactory.createByReadingToMemory(RandomAccessSourceFactory.java:263) at com.itextpdf.text.io.RandomAccessSourceFactory.createBestSource(RandomAccessSourceFactory.java:173) at com.itextpdf.text.pdf.RandomAccessFileOrArray.<init>(RandomAccessFileOrArray.java:148) at com.itextpdf.text.pdf.TrueTypeFont.process(TrueTypeFont

Shrink PDF pages with rotation using Rectangle in existing PDF

人走茶凉 提交于 2019-12-04 17:25:17
I am using following code to shrink every pages (Top and bottom) of existing pdf using iText library. Code working fine. But now if i process result pdf , i get 0 value for rotation of every page, while old pdf has other rotation too(i.e. 90deg). I want to keep rotation as it is but unable to do it. Code i am using As below to shrink pages public void shrinkPDFPages() throws Exception { PdfReader reader = new PdfReader("D:/testpdfs/test.pdf"); Document doc = new Document(); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream( "D://testpdfs/result.pdf")); doc.open();