Questions tagged [itext]

0

votes
1

answer
12

Views

Displaying data in PDF in organized and structured way

I am creating a fee voucher for a school on c# and the main problem that i am coming across is how do I display data on PDF in organized way like: Name: Student Name Name: Student Name Name:Student Name A/C#: 12345 A/C#: 12345 A/C#:12345 And when i run my progra...
Faheel Sattar
1

votes
2

answer
66

Views

How to take file from button

I made a application with iTextSharp to put numbers on a PDF file. As you will see in the following code, my application just can do this, only if the file is in a specific directory. So I made an "Other" button where the user can select a file. What I want to do now is, that the chosen file will do...
TravisTD
0

votes
0

answer
4

Views

How to give alternate description for a field in Itext.?

I am trying to generate an accessible digitally signed PDF using iText. I am able to create a pdf with digital signature but it is not accessible. I suppose it is because there is no alternate description for the field "sig". How do i give the alternate description here? public class C2_01_SignHello...
CoolKicks
1

votes
1

answer
163

Views

iTextSharp : Cannot attach PageEvent on a PdfSmartCopy writer

This code using ItextSharp 5.5.10: var msOutput = new MemoryStream(); var document = new Document(PageSize.A4, 0, 0, 0, 20); var writer = new PdfSmartCopy(document, msOutput); writer.PageEvent = new MyHeaderFooterEvents(); Throws "Operation is not valid due to the current state of the object." when...
Jean-Marie
1

votes
1

answer
412

Views

java replace word document bookmarks and convert to pdf

I tried to replace word document bookmarks using apache poi and convert it to pdf. It looks must works but I have many errors which links to each other.I solves one ,then here appear next one. What I do wrong? Which libraries I must have?
seyx sultan
0

votes
2

answer
12

Views

How to set default path for store PDF

I have to store this pdf file in my "/home/gnanaseelan/Documents/myfile" this location How is? ByteArrayInputStream bis = PDFGenerator.customerPDFReport(myLayout); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Disposition", "attachment;filename=mypdf.pdf"); return ResponseEntity .ok(...
Gnanaseelan
1

votes
0

answer
14

Views

Counting the number of attachments on a PDF using iText

I am trying to count the number of attachments on a PDF to verify our attachment code. The code I have works most of the time but recently it started failing when the number of attachments went up as well as the size of the attachments. Example: I have a PDF with 700 attachments which total 1.6 gb...
wrkoch
0

votes
0

answer
2

Views

How to add multiple Textfields in single or multiple pages

I am Using Itext 5 maven and I want to add multiple textfields in multiple pdf pages. like page 1 need 3 fields, page 2 need 4 fields etc. I have write the below code public byte[] setupDocument(EditPdfDTO editPdfDTOList, MultipartFile attachment) { WritePDF obj = new WritePDF(); Document document...
Deva
1

votes
1

answer
2.3k

Views

How to create and add table to predefined pdf template using Itext?

I have a predefined Template and i want to create and add table to 3rd page of template. Is it possible to do so?There are lot of option for creating new pdf using itext but i haven't seen any example where modifying existing pdf and adding table to it is provided. Code example will be highly appre...
Abdullah Farid
1

votes
1

answer
1.6k

Views

Dynamically positioning the table and bar chart generated using jfree chart

Hi All Iam using itextpdf-5.1.0.jar, displaying Table(the values in this table are fetched from the database based on start date and end date in the input screen) and bar chart for the values in the above table. The problem is I want to position the bar chart below the table, values that iam fetchin...
satish
1

votes
2

answer
2.6k

Views

IText - BarcodeQRCode making the background color transparent

I'm trying to set the background color of my QR Code using iText into a transparent background, however it does not work. Shows only white bars and black background. What i have done so far: My Code Snippet: PdfContentByte cb = writer.getDirectContent(); BarcodeQRCode qrcode = new BarcodeQRCode("sam...
Victor Soto
1

votes
1

answer
4.7k

Views

How to add multiple headers and footers in pdf using itext

In my pdf I need to have more than one header and footer.In header I want title heading on left and some text on the center. Likewise in footer I need to print my company name on the left side,page number on center and some info regarding the contents in my table on the right side. I have seen so ma...
Vignesh Vino
1

votes
1

answer
889

Views

Change a specific PdfPCell in itext for java?

I have table in itext. I need to change a specific cell width in the last row. Is it possible? edit: colspan does not cover my problem. I need completely different widths in this row.
Mohsen Kashi
1

votes
1

answer
2.2k

Views

How to get given paragraph content of pdf file using iText library?

Is there any way to get number of paragraphs or content of given paragraph in pdf file using iText library ?. I saw some classes like Paragraph, Chunk in some code to create new pdf file but I can not find any way to get these classes in reading file. Every idea is appreciated
thoitbk
1

votes
1

answer
1.7k

Views

Reading and writing the TOC for a PDF

My requirement is to prefix a PDF generated by some other process with a single 'cover page'. I've written a relatively simple Ant task to concatenate a list of PDF documents, and this works well, but the TOC is not preserved in the process. By TOC I mean .. Ideally, both TOCs would be preserved, a...
Martin Cowie
1

votes
1

answer
4.6k

Views

Using iText to open PDF documents after writing to them

Im using iText and the Document class in a JFrame to write PDFs but if i try to use the Runtime class to run it after creation i get an exception that i cant open it due to the locks still on it and if i run Unlocker on it, my JFrame has a lock token on it. How do i open the PDF if i want to write t...
Arhowk
1

votes
1

answer
2.5k

Views

How do I get my text to be both bold and italic in iText?

I am trying to make my text both bold and italic at the same time for a paragraph in a PDF document using iText. I can use either of these for bold and italic respectively, but not both simultaneously: Font font = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.FontStyle.BOLD.ordinal()); Font font =...
user2296988
1

votes
1

answer
2.5k

Views

Prevent copying pdf contents generated using iText

We have a web application which generates a report and saves it in pdf using iText. We want to prevent user from copying the contents from this file. I thought this can be achieved by converting pdf contents to image and then add that image to pdf but it seems iText cannot convert pdf to an image....
AndyT
1

votes
1

answer
1.2k

Views

iText continous PDF editing java

I'm using iText library to create and add data to a PDF. I want to add some textLines and an image to the PDF more than once until i close the file. numOfSamples = timeIHitTheButton(); . . . *a loop tha call it the number of times choosen by numOfSamples* DSM.saveData(); The DataStore (DSM is a Dat...
Igr
1

votes
3

answer
2.3k

Views

Separating PDF pages in Java [closed]

I am trying to separate one large PDF into several smaller PDFs of varying lengths. At first I tried reading the original PDF with a FileInputStream and finding the signature hex strings to split it into smaller files with a FileOutputStream (as I have done with JPGs). However, I can't seem to find...
user2484253
1

votes
1

answer
1.6k

Views

Can't add ltv to PDF document. Error

I'm sign document, using Itext. I have that method: public static void sign(String src, String dest, Certificate[] chain,PrivateKey pk, String digestAlgorithm, String provider,CryptoStandard subfilter, TSAClient tsa ) { // Creating the reader and the stamper PdfReader reader = new PdfReader(src); Fi...
1

votes
1

answer
2.2k

Views

Custom-built iText version required by JasperReports library?

I tried to add jasper reports library (net.sf.jasperreports:jasperreports:5.2.0) as a maven dependency to my project , unfortunately one of it's dependencies com.lowagie:itext:2.1.7.js2 is a little bit untypical and cannot be located in maven central. I've found, however, that it's available at http...
Adam Dyga
1

votes
1

answer
6.7k

Views

how to store arraylist value in string array

com.itextpdf.text.DocumentException: java.lang.ArrayStoreException Q. When trying following code which is trying to change ArrayList to String[] array type above Exception happened.I don't know what's wrong. try { Class.forName("com.mysql.jdbc.Driver"); String url ="jdbc:mysql://localhost/falg_check...
XeeMez AsHu
1

votes
1

answer
1.8k

Views

Points -> pixels iText (im)precision

Okay, here's some code (pdfDocument is a com.itextpdf.text.Document): PdfPTable table = new PdfPTable(1); PdfPCell cell = new PdfPCell(); cell.setFixedHeight(3f); for (int i = 1; i < 100; i++) { table.addCell(cell); } pdfDocument.add(table); According to my calculations (pixels = points / 0.75f) 3f...
Karlovsky120
1

votes
1

answer
2k

Views

Convert 8-bit Indexed color to RGB

I cannot find a conversion routine for converting 8-bit indexed color to RGB. For some background details, I am using POI to read an xlsx file and one of the cells has a background color indexed as value 64. When I attempt to create a PdfPCell in iText with this value for the background BaseColor, I...
Paul Gregoire
1

votes
1

answer
4k

Views

how to create a properties file for keystore?

I have created a key store and extracted the public key. In order to use key store I've created a keyproperties.properties file, but I'm not sure about the property called "PRIVATE". I'm totally confused whether that is a path or private key password or something else. properties file -> with .prope...
kerZy Hart
1

votes
1

answer
547

Views

xlst transform doens't close tags

I'm transforming an xml file into a html file with a xslt transformation: TransformerFactory factory = TransformerFactory.newInstance(); Source xslt = new StreamSource(new File("transform.xsl")); Transformer transformer = factory.newTransformer(xslt); Source text = new StreamSource(new File("test.xm...
user2451415
1

votes
1

answer
1.6k

Views

The pdf file size is huge created through iTextSharp

I am using iTextSharp to create PDF file, and I already added these code: ..................................................... PdfWriter writer = PdfWriter.GetInstance(document, filestream); writer.SetPdfVersion(PdfWriter.PDF_VERSION_1_5); writer.CompressionLevel = PdfStream.BEST_COMPRESSION; write...
Gisway
1

votes
1

answer
3.7k

Views

Using iTextPDF to trim a page's whitespace

I have a pdf which comprises of some data, followed by some whitespace. I don't know how large the data is, but I'd like to trim off the whitespace following the data PdfReader reader = new PdfReader(PDFLOCATION); Rectangle rect = new Rectangle(700, 2000); Document document = new Document(rect); Pdf...
Andy N
1

votes
1

answer
1.3k

Views

how to get HTML text before rendering to browser - using servlet

Want to save three to four months of development time. Because JSPs are already written. Following program converts HTML into PDF format. Line 5 is written into the PDF file without HTML tags.Now the question is, how can I get HTML text inside Servlet before JSP file renders it to the browser, so th...
AmitG
1

votes
1

answer
3.5k

Views

Correct text position center in rectangle iText

I try to draw text inside rectangle which fit rectangle size, like my previous question, I want text align center in rectangle. The problem is display text has wrong Y coordinate, look like this one: And here is my code: PdfContentByte cb = writer.getDirectContent(); Rectangle rect = new Rectangle(1...
R4j
1

votes
2

answer
834

Views

How to make PDF with turning page ability?

In one of the weirdest client's requirement we need to devlop a functionality to generate a pdf document from java program(i did it with iText). But the view of pdf is problem. The client wants pdf generated in such a way that, it should have functionality of turning the page like we do in html usin...
Ishan Bhatt
1

votes
1

answer
1.8k

Views

How to create pdf with font information and embed actual font when merging them into a single pdf

I create pdfs and concatenate them into a single pdf. My resulting pdf is a lot bigger than I had expected in file size. I realised that my pdf has a ton of duplicate font, and it is the reasone of unexpectedly big pdf. Here, my qustion is: I would like to create pdfs which only embed font informati...
jongseok
1

votes
1

answer
1.2k

Views

Can't export Vietnamese characters to PDF using iText

I'm trying to export Vietnamese characters to PDF using iText. I tried to use BaseFont bf = BaseFont.createFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); It displays some unicode characters correctly, for example Russian, but not the ones with accents in Vietnamese language (ạ,ã,ố etc....
Pepperoni Papaya
1

votes
2

answer
1.7k

Views

Arabic caracters in html to pdf using iText

I've gone through avery iText topic related to arabic caracters on stackoverflow already, but didn't find an answer for this one. I need to convert an html file in to pdf, but this html contains both english and arabic caracters. Displaying the html in Notepadd++ or in any browser, there is no probl...
A.LnG
1

votes
3

answer
26.9k

Views

java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1Encodable

I use iText 5.5.0 and BouncyCastle bcprov-jdk15on-1.50 for digitally signing a pdf. It all works fine if I do not include a time stamp in the MakeSignature.signDetached method. When I use the TSAClient specifying the TSAURL, my code gives me the error java.lang.NoClassDefFoundError: org/bouncycastle...
user3412670
1

votes
1

answer
6.8k

Views

java.lang.ClassNotFoundException: org.bouncycastle.asn1.ASN1Encodable

I am using IText 4.2.0 and bcprov-jdk15-1.43.jar and bctsp-jdk15-1.43.jar for signing pdf. I added these jars by add external jars button in Eclipse. When I execute it gives me following error. ExceptionConverter: java.lang.Exception: Failed to get TSA response from tsaURL at com.lowagie.text.pdf.TS...
user3412670
1

votes
3

answer
314

Views

iText making a whole roll in table coloured

What's the simplest way to make a whole table row coloured in a PDF using iText? At the moment my code below only colours a specific cell in the table but I am not sure how to make the entire row coloured. Would appreciate if somebody can tell me how this is done but please do not post any code! I'...
user3281466
1

votes
1

answer
1.2k

Views

itext font color gets darker in first page

I'm using iText 2.1.7,i'm adding header and footer at absolute position using writer.getDirectcontent() method.All is working fine except the fonts in first page gets darker than second pages. Note the Header and Footer in First and second pages anyhelp? Here is what i did Reader stringReader = new...
Gowrish
1

votes
2

answer
1.6k

Views

How do I change the weight of a simulated bold font using itext

I am using the iText library to generate text. I am loading the Arial Unicode MS font which does not contain a bold style so iText is simulating the bold. This works fine, but the weight of the bold font appears too heavy compared with text generated using the Java API or even using Microsoft Word....
Lynn

View additional questions