itext

How do I get a TextField from AcroFields using iText/Sharp?

风格不统一 提交于 2020-01-06 02:30:10
问题 I am using iTextSharp to loop through the fields in the AcroFields collection so I can set a various properties on an annotation. I have worked out how to pull most of the properties for each of the annotation fields, but would like to be able to cast the individual annotation to the correct field object (i.e., TextField , PushButtonField , RadioCheckField , etc.). Short of creating a new TextField , reading and then setting all of the settings/properties associated with it, is there a

How to add tables in footer of PDF in java using itext

依然范特西╮ 提交于 2020-01-06 02:12:08
问题 As I am new to iText . I don't know how to add table in footer of pdf using iText 1.4 . I already added table in header and it works fine. But in case of footer, it is not working properly. Anybody please help me. Thanks in advance 回答1: If you use the latest version of iText (5.2.x), headers and footers are best managed via Page Events. See these examples taken from the iText in Action book. 来源: https://stackoverflow.com/questions/10562257/how-to-add-tables-in-footer-of-pdf-in-java-using

iText - Java Android - Adding fields to existing pdf

本小妞迷上赌 提交于 2020-01-06 01:57:54
问题 I'm trying to add interactive fields to an existing PDF, i use a PdfReader and a PdfStamper to do this, and when i open it on my tablet, everything is ok. However, when I want to open it on my computer, there are no fields. This is a sample of my code, I have more than one field for each page but i only printed two fields here: public class SelfNoteFragment extends Fragment { private PdfStamper pdfStamper; class MyCellField implements PdfPCellEvent { protected String fieldname; protected int

iText - Java Android - Adding fields to existing pdf

情到浓时终转凉″ 提交于 2020-01-06 01:57:29
问题 I'm trying to add interactive fields to an existing PDF, i use a PdfReader and a PdfStamper to do this, and when i open it on my tablet, everything is ok. However, when I want to open it on my computer, there are no fields. This is a sample of my code, I have more than one field for each page but i only printed two fields here: public class SelfNoteFragment extends Fragment { private PdfStamper pdfStamper; class MyCellField implements PdfPCellEvent { protected String fieldname; protected int

BadPasswordException: Bad user password

为君一笑 提交于 2020-01-05 15:45:13
问题 I am creating an encrypted PDF using this code: Document document = new Document( new Rectangle(PageSize.A4.getWidth(), PageSize.A4.getHeight())); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT1)); writer.setBoxSize("art", new Rectangle(36, 54, 555, 791)); writer.setEncryption("Vibhu".getBytes(), "Vibhu@123456789".getBytes(), PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128); document.open(); // Creating Tables and Cells document.close(); I omitted to

BadPasswordException: Bad user password

≡放荡痞女 提交于 2020-01-05 15:45:08
问题 I am creating an encrypted PDF using this code: Document document = new Document( new Rectangle(PageSize.A4.getWidth(), PageSize.A4.getHeight())); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT1)); writer.setBoxSize("art", new Rectangle(36, 54, 555, 791)); writer.setEncryption("Vibhu".getBytes(), "Vibhu@123456789".getBytes(), PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128); document.open(); // Creating Tables and Cells document.close(); I omitted to

iText partial HTML rendering

三世轮回 提交于 2020-01-05 12:16:25
问题 I am using iText PDF library for Java in order to generate PDF. I want to partially render some HTML content instead of the whole document. Here is the section that I want to partially render as HTML. waterIndexTrendTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); waterIndexTrendTable.addCell(new Phrase(weit.getUnit(), smallFont)); waterIndexTrendTable is a PdfPTable. weit.getUnit() returns content with HTML tags. I want to render HTML to the PDF. 回答1: If weit.getUnit()

How to change width of single column of a table?

丶灬走出姿态 提交于 2020-01-05 09:28:56
问题 hello I have created table in PDF file using Itext library heading of my table columns are Medicine Name, Doses, time My problem is: this is how my columns look like: |Medicin|Doses|time| | e name| | | as you can see e falls in new line I have tried many things but cant figure out how to arrange my columns like : |Medicine|Doses|time| | name | | | 回答1: The ColumnWidths example demonstrates different ways of changing the width of a column. This is one specific way: PdfPTable table = new

How to change width of single column of a table?

血红的双手。 提交于 2020-01-05 09:26:26
问题 hello I have created table in PDF file using Itext library heading of my table columns are Medicine Name, Doses, time My problem is: this is how my columns look like: |Medicin|Doses|time| | e name| | | as you can see e falls in new line I have tried many things but cant figure out how to arrange my columns like : |Medicine|Doses|time| | name | | | 回答1: The ColumnWidths example demonstrates different ways of changing the width of a column. This is one specific way: PdfPTable table = new

Generate Html to Pdf using ItextSharp blank file generate

China☆狼群 提交于 2020-01-05 09:14:00
问题 I am using Itexsharp.dll for generate html to pdf with webapi and angular 2, but I am return bytes array from webapi and open bytes in angular 2 with Blob but when open pdf it was blank. My code is here IN Web api code: - HttpResponseMessage response = new HttpResponseMessage(); MemoryStream workStream = new MemoryStream(); StringReader sr = new StringReader(htmlPdfContent.ToString()); using (MemoryStream memoryStream = new MemoryStream()) { using (Document pdfDoc = new Document(PageSize.A4))