itext

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

浪子不回头ぞ 提交于 2019-12-30 15:45:35
问题 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];

making pdf as password protected with java

蹲街弑〆低调 提交于 2019-12-30 13:26:07
问题 I want to make an existing PDF as password protected for which I'm using the itext I am following this URL http://howtodoinjava.com/2014/07/29/create-pdf-files-in-java-itext-tutorial/ I have developed a program which will send the mail with the PDF as attachment. Below is the code where I am making the PDF file as password protected. Right now the PDF file is attached in mail but when I am trying to open it, I get an error that it is damaged. What am I doing wrong in the code below? //

Reading PDF Bookmarks in VB.NET using iTextSharp

大憨熊 提交于 2019-12-30 11:13:05
问题 I am making a tool that scans PDF files and searches for text in PDF bookmarks and body text. I am using Visual Studio 2008 with VB.NET with iTextSharp. How do I load bookmarks' list from an existing PDF file? 回答1: It depends on what you understand when you say "bookmarks". You want the outlines (the entries that are visible in the bookmarks panel): The CreateOnlineTree examples shows you how to use the SimpleBookmark class to create an XML file containing the complete outline tree (in PDF

How can I extract images and their metadata from PDFs?

 ̄綄美尐妖づ 提交于 2019-12-30 09:18:27
问题 Is it possible to use Java to extract images from a PDF file and export them to a specific folder without losing their original creation and modification dates? I tried to achieve this goal by using IText and PDFBox but had no success. Any ideas or examples are welcome. 回答1: Images do not contain metadata and are stored as raw data which needs to be assemebled into images. I wrote 2 blog posts explaining how image data is stored in a PDF file at https://blog.idrsolutions.com/2010/04

Obtaining the hash/digest from a PCKS7 signed PDF file with iText

跟風遠走 提交于 2019-12-30 07:43:32
问题 I'm writing a Java web service that signs PDF documents with iText from some clients in the network. Documents are being signed correctly, and can be verified with external tools. However, due to some legal restrictions in order to store this document in an official documentary repository I have to provide the hash/digest message from the signature. I have tried almost anything to get to that hash, but the closest that I can get is to obtain the whole signature (CERT+HASH/DIGEST+TIMESTAMP) as

How to create a PDF with iText+XMLWorker from servlet using custom font?

元气小坏坏 提交于 2019-12-30 07:31:33
问题 Playing with iText/XMLWorker samples (mostly this one), I could easily write simple applications able to create PDF files from HTML code using my own extra fonts, but as soon as tried to use my stuff in some web service code, I ended with exceptions like: Table 'name' does not exist in file:/C:/work/MyServer/target/classes/fonts/My%20Font.ttf ExceptionConverter: com.itextpdf.text.DocumentException: Table 'name' does not exist in file:/C:/work/MyServer/target/classes/fonts/My%20Font.ttf ..

How to create a PDF with iText+XMLWorker from servlet using custom font?

霸气de小男生 提交于 2019-12-30 07:31:32
问题 Playing with iText/XMLWorker samples (mostly this one), I could easily write simple applications able to create PDF files from HTML code using my own extra fonts, but as soon as tried to use my stuff in some web service code, I ended with exceptions like: Table 'name' does not exist in file:/C:/work/MyServer/target/classes/fonts/My%20Font.ttf ExceptionConverter: com.itextpdf.text.DocumentException: Table 'name' does not exist in file:/C:/work/MyServer/target/classes/fonts/My%20Font.ttf ..

Whats the alternative to copyAcroForm?

十年热恋 提交于 2019-12-29 09:28:33
问题 We are currently porting our code base from iText 2.1.7 to iText 5.5.0 (yeah I know.. we had a little longer ;-). Well.. "now" that copyAcroForm has gone the way of the Dodo, I'm struggling to find an alternative to this code: File outputFile = new File... Document document = new Document(); FileOutputStream fos = new FileOutputStream(outputFile); PdfCopy subjobWriter = new PdfCopy(document, fos); document.open(); PdfReader reader = new PdfReader(generationReader); for (int i=1; i<=reader

Generating large pdf without having content in main memory

血红的双手。 提交于 2019-12-29 09:27:10
问题 I am using iText to generate very large tables in pdf format. What is the best way to generate these tables instead of having the entire content in memory? If I just increase the below size in the for loop to a million I run out of memory, is there a better way to stream it than having the entire content in memory I saw this post How to directly stream large content to PDF with minimal memory footprint? But I want to know what iText api to use. Example Code: import java.io.FileOutputStream;

Can I tell iText how to clip text to fit in a cell

可紊 提交于 2019-12-29 09:24:13
问题 When I call setFixedHeight() on a PdfPCell, and add more text than fits in the given height, iText seems to print the prefix of the string which fits. Can I control this clipping algorithm? For example: Print a suffix of the string rather than a prefix. Mark a substring of the string as not to be removed. This is with footnote references. If I add text saying "Hello World [1]", the [1] is a reference to a footnote and should not be removed. It's okay to remove the other characters of the