Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 06B831844F for ; Wed, 3 Jun 2015 15:46:32 +0000 (UTC) Received: (qmail 51026 invoked by uid 500); 3 Jun 2015 15:46:31 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 51004 invoked by uid 500); 3 Jun 2015 15:46:31 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 50987 invoked by uid 99); 3 Jun 2015 15:46:31 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jun 2015 15:46:31 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8C5C61802E8 for ; Wed, 3 Jun 2015 15:46:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.12 X-Spam-Level: X-Spam-Status: No, score=-0.12 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=lehmi.de Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id HgffZuJOteBJ for ; Wed, 3 Jun 2015 15:46:25 +0000 (UTC) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.216]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 4586C428FF for ; Wed, 3 Jun 2015 15:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1433346315; l=2361; s=domk; d=lehmi.de; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References: Subject:To:MIME-Version:From:Date; bh=6YeOV3U8PEiuHxYi/dAso+9hPxumTPHfnc8KMjWnwQw=; b=FLs509T9fSqnBfBNWa3n0TagrE/ubxKHgQEtyICopuRujXPpiVevCcyE3KKPKi5GPOK qburR3zefcuLoLgr3ywgExE+mMDrL+nHlWRpyLjQA8tz2c3+Da1UzG20v7OSgSdiPRd3J 4BsT/osb+OphnABBlMenBI2PMcfoZCA1E40= X-RZG-AUTH: :LWIAZ0WpaN8UY5o8XRz0jOyrHsdEC+nAE10OdySrgHvIRPUZmp5uQ3MyIudp X-RZG-CLASS-ID: mo00 Received: from [192.168.1.8] (dslb-188-103-012-017.188.103.pools.vodafone-ip.de [188.103.12.17]) by smtp.strato.de (RZmta 37.6 DYNA|AUTH) with ESMTPSA id R01f95r53FjEHcI (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate) for ; Wed, 3 Jun 2015 17:45:14 +0200 (CEST) Message-ID: <556F210A.2050802@lehmi.de> Date: Wed, 03 Jun 2015 17:45:14 +0200 From: Andreas Lehmkuehler User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: users@pdfbox.apache.org Subject: Re: Scratch files - too many files open References: <556DBA6F.103@gmail.com> <556DD05D.1000202@lehmi.de> <556EA29A.5030403@gmail.com> <1591940318.908920.1433328374439.JavaMail.open-xchange@ptangptang.store> <556EE314.1010204@gmail.com> In-Reply-To: <556EE314.1010204@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Hi, Am 03.06.2015 um 13:20 schrieb Jesse Long: > On 03/06/2015 12:46, Andreas Lehmk�hler wrote: >> Hi, >> >>> Jesse Long hat am 3. Juni 2015 um 08:45 geschrieben: >>> >>> >>> On 02/06/2015 17:48, Andreas Lehmkuehler wrote: >>>> Hi, >>>> >>>> Am 02.06.2015 um 16:15 schrieb Jesse Long: >>>>> Hi All, >>>>> >>>>> Regarding PDFBOX-2301, and the use of scratch files: right now, each >>>>> COSStream >>>>> uses one or two scratch files. >>>>> >>>>> I recently ran into the problem on Linux where the max number of open >>>>> files >>>>> allowed to the JVM by the OS was reached because of this. >>>>> >>>>> Is there a plan around this? >>>>> >>>>> Is it maybe that my use case is not expected? >>>> I'm aware of that. The refactoring is still in progress. I expect to >>>> reduce the number of open files. >>>> >>>>> My use case is: >>>>> Open PDDocument 1 >>>>> Open PDDocument 2 >>>>> for a few hundred times >>>>> import page 1 of PDDocument 1 into PDDocument 2 and overlay >>>>> some stuff >>>>> ontop. >>>>> save PDDocument 2. >>>>> >>>>> I have written a patch to use one single java.io.RandomAccessFile as >>>>> a scratch >>>>> file per COSDocument, using pages in a doubly linked list to separate >>>>> streams in >>>>> the same file. Would you be interested in adding this to PDFBox? >>>> To use one file only led to problems when creating pdfs from scratch. >>>> It is possible to write to 2 COSStreams at the same time which >>>> corrupts pdf. >>> Hi Andreas, >>> >>> Do you mean at the same time, as in multiple threads, or single thread >>> writing a bit to this stream and then a bit to another stream back and >>> forth? >> It's about the second case. You can't add fonts and/or images to a page while >> adding content to a contentstream the same time. You have to add those before >> opening a stream or you have to close the stream before >> >>> For the single thread use case, I have solved this in my patch. >>> Actually, even multiple thread should be easy to support with >>> synchronization. I'll work on some docs and submit and you can see if >>> you like it. >> At least it sounds interesting and I'm happy to look at it. >> > > Please see patch attached. Looks promising, I'll have a deeper look later. > Thanks, > Jesse Thanks, Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org For additional commands, e-mail: users-help@pdfbox.apache.org