Two 1.6G files won't do. The error was that you ran out of virtual space and need a 64 bit machine. You may revert to the RandomAccessFile instead of a mapped file but I doubt that iText can perform reasonably with such big files.
Paulo ----- Original Message ----- From: "Davy Lee" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, December 18, 2006 9:43 AM Subject: Re: [iText-questions] How to merge two 3G size pdf fast > > When I tried to process two 1.6G pdf file, an error occured: > > java.io.IOException: Not enough storage is available to process this > command > at sun.nio.ch.FileChannelImpl.map0(Native Method) > at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:742) > at > com.lowagie.text.pdf.MappedRandomAccessFile.init(MappedRandomAccessFile.java:103) > at > com.lowagie.text.pdf.MappedRandomAccessFile.<init>(MappedRandomAccessFile.java:87) > at > com.lowagie.text.pdf.RandomAccessFileOrArray.<init>(RandomAccessFileOrArray.java:121) > at > com.lowagie.text.pdf.RandomAccessFileOrArray.<init>(RandomAccessFileOrArray.java:80) > at com.lowagie.text.pdf.PRTokeniser.<init>(PRTokeniser.java:108) > at com.lowagie.text.pdf.PdfReader.<init>(PdfReader.java:155) > at com.lowagie.text.pdf.PdfReader.<init>(PdfReader.java:145) > at sticker.Main.main(Main.java:60) > > > it means that the error occured at : > reader = new PdfReader(new RandomAccessFileOrArray(fileList[docNum]), > null); > > however, in the book "ITEXT in action" said: using new > RandomAccessFileOrArray(fileList[docNum]) > in the pdfreader constructor will partial read the original file, I'm > confusing. > > if the error occurs in the pdfReader constructor, it will be still no > useful > to rewrite the pdfcopy class or > the pdfwriter class. > > cheers, > Davy Lee > > > > > Paulo Soares wrote: >> >> The total size of the file can't be 2G so it would be like two 1G files. >> Doing this will always take a lot of time and a lot of memory unless the >> number of pages is small. To merge such big files efficiently you'd have >> to >> create a customized PdfCopy. >> >> Paulo >> >> ----- Original Message ----- >> From: "Davy Lee" <[EMAIL PROTECTED]> >> To: <[email protected]> >> Sent: Monday, December 18, 2006 8:31 AM >> Subject: Re: [iText-questions] How to merge two 3G size pdf fast >> >> >>> >>> Dear Paulo, >>> even for two 2G pdf file, do u have a better sosution to merge them, >>> sometimes I don't need to modify the pages, sometime I do. >>> cheers. >>> >>> Davy lee >>> >>> >>> Paulo Soares wrote: >>>> >>>> You'll certainly won't use iText to do this. iText has a 2G size >>>> limitation. >>>> >>>> Paulo >>>> >>>> ----- Original Message ----- >>>> From: "Davy Lee" <[EMAIL PROTECTED]> >>>> To: <[email protected]> >>>> Sent: Monday, December 18, 2006 4:11 AM >>>> Subject: [iText-questions] How to merge two 3G size pdf fast >>>> >>>> >>>>> >>>>> I have two 3G size pdf files, we need to use ITEXT to merge them into >>>>> one >>>>> single new pdf document. >>>>> However, to do this will waste too much time to finished it. It would >>>>> cost >>>>> us about half days to finish >>>>> to merging process. Do u guys have any new solution to do it? cheers. >>>>> My code is below: >>>>> >>>>> //pdf files array list. >>>>> String [] fileList = {"sample1.pdf","sample2.pdf"}; >>>>> >>>>> Document document; >>>>> PdfCopy copy; >>>>> PdfReader reader; >>>>> >>>>> try >>>>> { // step 1 >>>>> document = new Document(); >>>>> // step 2 >>>>> copy = new PdfCopy(document, new FileOutputStream( >>>>> "sample_Combination.pdf")); >>>>> // step 3 >>>>> document.open(); >>>>> for(int docNum=0; docNum<fileList.length;docNum++) >>>>> { >>>>> reader = new PdfReader(new >>>>> RandomAccessFileOrArray(fileList[docNum]), null); >>>>> int pages = reader.getNumberOfPages(); >>>>> // step 4 >>>>> for (int pageNum = 0; pageNum < pages; ) >>>>> { >>>>> ++pageNum; >>>>> copy.addPage(copy.getImportedPage(reader, >>>>> pageNum)); >>>>> }//iterate page loop. >>>>> }// iterate doc loop. >>>>> >>>>> // step 5 >>>>> document.close(); >>>>> >>>>> >>>>> >>>>> } >>>>> catch(IOException e) >>>>> { >>>>> e.printStackTrace(); >>>>> } >>>>> catch (DocumentException e) >>>>> { >>>>> e.printStackTrace(); >>>>> } >>>>> >>>>> very big thanks in advance. >>>>> -- >>>>> View this message in context: >>>>> http://www.nabble.com/How-to-merge-two-3G-size-pdf-fast-tf2837983.html#a7923347 >>>>> Sent from the iText - General mailing list archive at Nabble.com. >>>>> >>>>> >>>>> ------------------------------------------------------------------------- >>>>> Take Surveys. Earn Cash. Influence the Future of IT >>>>> Join SourceForge.net's Techsay panel and you'll get the chance to >>>>> share >>>>> your >>>>> opinions on IT & business topics through brief surveys - and earn cash >>>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >>>>> _______________________________________________ >>>>> iText-questions mailing list >>>>> [email protected] >>>>> https://lists.sourceforge.net/lists/listinfo/itext-questions >>>>> Buy the iText book: http://itext.ugent.be/itext-in-action/ >>>> >>>> >>>> ------------------------------------------------------------------------- >>>> Take Surveys. Earn Cash. Influence the Future of IT >>>> Join SourceForge.net's Techsay panel and you'll get the chance to share >>>> your >>>> opinions on IT & business topics through brief surveys - and earn cash >>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >>>> _______________________________________________ >>>> iText-questions mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/itext-questions >>>> Buy the iText book: http://itext.ugent.be/itext-in-action/ >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/How-to-merge-two-3G-size-pdf-fast-tf2837983.html#a7925099 >>> Sent from the iText - General mailing list archive at Nabble.com. >>> >>> >>> ------------------------------------------------------------------------- >>> Take Surveys. Earn Cash. Influence the Future of IT >>> Join SourceForge.net's Techsay panel and you'll get the chance to share >>> your >>> opinions on IT & business topics through brief surveys - and earn cash >>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >>> _______________________________________________ >>> iText-questions mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/itext-questions >>> Buy the iText book: http://itext.ugent.be/itext-in-action/ >> >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to share >> your >> opinions on IT & business topics through brief surveys - and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> iText-questions mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/itext-questions >> Buy the iText book: http://itext.ugent.be/itext-in-action/ >> >> > > -- > View this message in context: > http://www.nabble.com/How-to-merge-two-3G-size-pdf-fast-tf2837983.html#a7925842 > Sent from the iText - General mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
