itext

Add a PDFPTable to bottom of page in iText

自闭症网瘾萝莉.ら 提交于 2020-01-01 12:01:12
问题 I'm trying to add a table as a footer containing all the copyright text, page number etc. But I can't find any supporting method that'll accept a PdfPTable For a phrase there is code like: ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase( String.format("%d", document.getPageNumber())), (document.getPageSize().getLeft() + document.getPageSize().getRight())/2, document.getPageSize().getBottom() + 18, 0); 回答1: The PdfPTable class has a method

iText table rowspan for right to left direction(Arabic)

无人久伴 提交于 2020-01-01 11:57:45
问题 My application is developed in two different version English and Arabic. I have created pdf table in iText with rowspan and colspan which is working perfectly in English version but in arabic version rowspan is not working. when i'm using setRunDirection(3) to put arabic text in my table,the setRowspan(2) is not working. please tell me how set rowspan value here. please help me to solve this issue. Thanks This is part of code for table size 2 column and rowspan 2. BaseFont base=BaseFont

How to set a custom color in itext?

非 Y 不嫁゛ 提交于 2020-01-01 09:12:34
问题 Thanks for taking the time to answer my question. I'm generating a PDF document using iText in Java. I need to set the column headers of a table a different colour than the ones in the values columns. I have the color hexadecimal value from Photoshop. I'm using PdfPTable with chunks and paragraphs. how do I set them to a different colour, other than the ones predefined in the BaseColor enum? Thanks in advance! 回答1: You'll need to take your 8-bit hexadecimal color value and convert it to 8-bit

Using iText, how can I apply css to my PDF document using CssResolver and CssFile?

烈酒焚心 提交于 2020-01-01 08:49:12
问题 Thanks for your help... Problem While converting an html table tag/snippet (which I have converted to string) into a PDF document... I am able to successfully apply css styles to the PDF document using this technique... CSSResolver cssResolver = XMLWorkerHelper.getInstance().getDefaultCssResolver(false); cssResolver.addCss("td {border-right: white .1px solid;}", true); But, I am unsuccessful applying css to the PDF document using existing a css file (i.e., using CssFile object), like this...

Appending a data in itext in existing pdf

不羁的心 提交于 2020-01-01 06:43:09
问题 I am working with itext pdf library. I want to add a content at the end of the existing pdf. Say for example the existing pdf(say Original.pdf) is having say 4 pages, so I want to add another page i.e. page no 5 with content Hello World I am added content and save it in the same pdf i.e. Original.pdf So after closing my Original.pdf will contain 5 pages i.e 4 pages(with default content they already have) + 1 page with content Hello World I am added content I am using this code but showing an

iTextSharp table width 100% of page

谁说胖子不能爱 提交于 2020-01-01 03:59:06
问题 I'm trying to add a table to a document using iTextSharp. Here is an example: Document document = new Document(PageSize.LETTER,72, 72, 72, 72); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("C:\\test.pdf", FileMode.Create)); document.Open(); Table table = new Table ( 2, 1 ); table.Width = document.RightMargin - document.LeftMargin; // Cell placeholder Cell cell = new Cell ( new Paragraph ( "Some Text" ) ); table.AddCell ( cell ); cell = new Cell ( new Paragraph ( "More

document has no pages with itext

爱⌒轻易说出口 提交于 2020-01-01 03:14:35
问题 <% OutputStream output=response.getOutputStream(); response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "inline; filename=details.pdf"); try{ Document document = new Document(); PdfWriter writer=PdfWriter.getInstance(document, output); document.open(); XMLWorkerHelper worker = XMLWorkerHelper.getInstance(); Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/a", "root", "root"); Statement st=con

iTextsharp, PdfPCell.VerticalAlignment and PdfPCell.HorizontalAlignment

♀尐吖头ヾ 提交于 2019-12-31 17:51:40
问题 Im trying to figure out how to get my text inside a PdfPCell to show in the middle. I have tried many different options, like: myCell.VerticalAlignment = Element.ALIGN_MIDDLE; myCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; myCell.VerticalAlignment = Rectangle.ALIGN_MIDDLE; None of that works for me. VerticalAlignment takes an int, so I tried to make a loop, to see if i could find the right number, but everything just get left bottom align.. Document myDocument = new Document(PageSize.A4);

iText - add content to the bottom of an existing page

て烟熏妆下的殇ゞ 提交于 2019-12-31 07:32:26
问题 I want to add a piece of text to every page of a PDF file. This answer in SO works fine. But, the text is added to the top of the page. I would like to add my text to the bottom of each page. How do I do this? Here is the relevant part of the code. while (iteratorPDFReader.hasNext()) { PdfReader pdfReader = iteratorPDFReader.next(); // Create a new page in the target for each source page. while (pageOfCurrentReaderPDF < pdfReader.getNumberOfPages()) { document.newPage();

iText - add content to the bottom of an existing page

眉间皱痕 提交于 2019-12-31 07:31:27
问题 I want to add a piece of text to every page of a PDF file. This answer in SO works fine. But, the text is added to the top of the page. I would like to add my text to the bottom of each page. How do I do this? Here is the relevant part of the code. while (iteratorPDFReader.hasNext()) { PdfReader pdfReader = iteratorPDFReader.next(); // Create a new page in the target for each source page. while (pageOfCurrentReaderPDF < pdfReader.getNumberOfPages()) { document.newPage();