There's nothing wrong but you'll need tons of memory because of the
beads in the page. The solution is for each page in PdfReader before
importing it:

PdfReader reader = ...;
PdfDictionary page = reader.getPageN(n);
page.remove(PdfName.B); 

> -----Original Message-----
> From: Lorenzo Boffelli [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, September 04, 2005 2:35 PM
> To: Paulo Soares
> Subject: RE: [iText-questions] iText with big PDF file
> 
> Here you have a link to download the file.
>  
> http://xoomer.virgilio.it/......
> 
> Let me know....
> Thank you
> Lorenzo
>  
> 
> Paulo Soares <[EMAIL PROTECTED]> ha scritto: 
> 
>       Post a link to the file. 
>       
>       > -----Original Message-----
>       > From: [EMAIL PROTECTED] 
>       > [mailto:[EMAIL PROTECTED] On 
>       > Behalf Of Lorenzo Boffelli
>       > Sent: Thursday, September 01, 2005 2:34 PM
>       > To: [email protected]
>       > Subject: [iText-questions] iText with big PDF file
>       > 
>       > Hello,
>       > I tried to use iText.
>       > I made a simple program able to copy a PDF document.
>       > Just read a document and create another one copying one page 
>       > at a time.
>       > The source code below.
>       > I used some code from the Concatenate.java example.
>       > The program works with several files but I have a 11MByte PDF 
>       > file that get the program crazy.
>       > When I run copyPDF on this file I have the following output:
>       > Import pages as images
>       > Permission = -64
>       > File Length= 11838051
>       > PDF Version= 3
>       > PDF Pag Num= 658
>       > 1
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyIndirect(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyDictionary(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyIndirect(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyDictionary(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyIndirect(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyDictionary(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyIndirect(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyDictionary(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyIndirect(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyDictionary(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyIndirect(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyArray(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyDictionary(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyIndirect(Unknown Source)
>       > at com.lowagie.text.pdf.PdfCopy.copyObject(Unknown Source)
>       > <... it continue for several lines ...>
>       > The created file is 6MByte long but it can not be opened with 
>       > Acrobat reader and it seems that it is not a PDF file.
>       > I tested the program with different files 5 and 6 MByte long 
>       > with no issues.
>       > Have anyone an idea about what can couse the issue?
>       > It is caused by the contents of the file?
>       > I can provide the "tricky" PDF file but it is 11MByte long ...
>       > Thank you to everyone will help me.
>       > Lorenzo
>       > P.S. copy the itext jar and copyPDF.java in the same 
> directory.
>       > build the program with:
>       > javac -classpath ./;./itext-1.3.3.jar copyPDF.java
>       > run the program with
>       > java -classpath ./;./itext-1.3.3.jar copyPDF my.pdf
>       > 
>       > 
>       > --------------------------------------------------------------
>       > ----------
>       > import java.io.FileOutputStream;
>       > import java.util.ArrayList;
>       > import java.util.List;
>       > import com.lowagie.text.Document;
>       > import com.lowagie.text.Rectangle;
>       > import com.lowagie.text.pdf.BaseFont;
>       > import com.lowagie.text.pdf.PdfContentByte;
>       > import com.lowagie.text.pdf.PdfImportedPage;
>       > import com.lowagie.text.pdf.PdfReader;
>       > import com.lowagie.text.pdf.PdfWriter;
>       > import com.lowagie.text.pdf.PRAcroForm;
>       > import com.lowagie.text.pdf.PdfCopy;
>       > import com.lowagie.text.pdf.PdfImportedPage;
>       > import com.lowagie.text.pdf.SimpleBookmark;
>       > public class copyPDF {
>       > public static void main(String[] args) {
>       > try {
>       > ArrayList master = new ArrayList();
>       > String outFile = "new-"+args[0];
>       > Document document = null;
>       > PdfCopy writer = null; 
>       > 
>       > // we create a reader for a certain document
>       > PdfReader reader = new PdfReader(args[0]);
>       > System.out.println("Permission = 
>       > "+reader.getPermissions());
>       > System.out.printl n("File Length= 
>       > "+reader.getFileLength());
>       > System.out.println("PDF Version= 
>       > "+reader.getPdfVersion());
>       > reader.consolidateNamedDestinations();
>       > // we retrieve the total number of pages
>       > int n = reader.getNumberOfPages();
>       > System.out.println("PDF Pag Num= "+n);
>       > 
>       > // step 1: creation of a document-object
>       > document = new 
>       > Document(reader.getPageSizeWithRotation(1));
>       > // step 2: we create a writer that listens to the document
>       > writer = new PdfCopy(document, new 
>       > FileOutputStream(outFile));
>       > 
>       > // step 3: we open the document
>       > document.open();
>       > // step 4: we add content
>       > PdfImportedPage page;
>       > for (int i = 0; i < n; ) {
>       > ++i;
>       > System.out.println(i);
>       > page = writer.getImportedPage(reader, i);
>       > writer.addPage(page);
>       > }
>       > document.close(); 
>       > }
>       > catch (Exception de) {
>       > de.printStackTrace();
>       > }
>       > }
>       > }
>       > 
>       > 
>       > ________________________________
>       > 
>       > Yahoo! Mail 
>       > 
>       > .com> : gratis 1GB per i messaggi, antispam, antivirus, POP3
>       > 
>       
> 
> ________________________________
> 
> Yahoo! Mail 
> <http://us.rd.yahoo.com/mail_it/taglines/*http://it.mail.yahoo
> .com> : gratis 1GB per i messaggi, antispam, antivirus, POP3
> 


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to