iText uses a memory mapped file. You may not enough enough contigiuos  
address space to map a file that large.

iText needs to be changed to support a simple RandomAccessFile and  
then it would work.

Doesn't matter anyway, since two 1.6 gig files would be larger than 2  
gig...


On Dec 18, 2006, at 3:43 AM, Davy Lee wrote:

>
> 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/

Reply via email to