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 E49D610E3A for ; Tue, 3 Mar 2015 21:32:50 +0000 (UTC) Received: (qmail 94387 invoked by uid 500); 3 Mar 2015 21:32:39 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 94366 invoked by uid 500); 3 Mar 2015 21:32:39 -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 94355 invoked by uid 99); 3 Mar 2015 21:32:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2015 21:32:39 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of edouglas@blockhouse.com designates 209.85.212.181 as permitted sender) Received: from [209.85.212.181] (HELO mail-wi0-f181.google.com) (209.85.212.181) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2015 21:32:33 +0000 Received: by wiwl15 with SMTP id l15so26218782wiw.5 for ; Tue, 03 Mar 2015 13:29:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=XI8vz/1DbyePW5WzMDq4o1kaFJ1iGBZKovioh252e+A=; b=kifg3vWjlf7c0wTrrqlwDis9DfgViWlPe21PvmdYpSNS4nDfCdZDBJclN5YOl2oign r5fVRCLIOJ9sPNoJ98mY4sY27CrZqFD0SB5TzIT8uLwE0H5q91IujmYLqXTfZ4sgh6Ru zbTZJ0/dTfDrBVfmWG3kLukVpEfs2zdGXSX5+YudUZAHNleHIcgfagF5MpCH4LZdZzzM yTCfwSBFgsC0oTTcnzIcaI79lcQyFtZP6cAYwi3NMg5LUA1iFCDrT0QxlvjlZjKt8PYY 2A30VYAdfOO93rMqxrCrVaYgOlxZCOH00GgrK+dWBAdauOhMinaTkjZjH0sLg2f1UBUg R2jQ== X-Gm-Message-State: ALoCoQkOfD5FsInOGKe9128tgTk/FXAbtirS2yH0folENPfN7NB1du67XmS3NCpmICZX4iOfpx1E MIME-Version: 1.0 X-Received: by 10.180.76.4 with SMTP id g4mr49625665wiw.43.1425418197933; Tue, 03 Mar 2015 13:29:57 -0800 (PST) Received: by 10.194.121.4 with HTTP; Tue, 3 Mar 2015 13:29:57 -0800 (PST) In-Reply-To: <54F624A4.3060702@t-online.de> References: <54F4E43E.3030908@t-online.de> <54F624A4.3060702@t-online.de> Date: Tue, 3 Mar 2015 16:29:57 -0500 Message-ID: Subject: Re: PDFBox 2.0 From: Eric Douglas To: users@pdfbox.apache.org Content-Type: multipart/alternative; boundary=f46d043893d75838a5051069090f X-Virus-Checked: Checked by ClamAV on apache.org --f46d043893d75838a5051069090f Content-Type: text/plain; charset=UTF-8 I see...that's one hack...instead of serializing the original PDF, create a new empty PDF, add the PDPage for that page, and convert that back to a byte[] array. That should work, should take slightly more processing on the server side to create the page objects, should use less memory than putting the original PDF into each page object and should serialize faster. Thanks. On Tue, Mar 3, 2015 at 4:16 PM, Tilman Hausherr wrote: > You can't serialze PDPage objects directly. What you can do is to create a > new PDF from it and save that one as a file or as a stream. > > Tilman > > Am 03.03.2015 um 14:22 schrieb Eric Douglas: > > I'm not sure what you mean "you can't cut a PDF". There is already a >> PDFRenderer which accepts a PDDocument in it's constructor and has a >> renderPageToGraphics method which draws a single page. The >> renderPageToGraphics method accepts a page number which just gets the >> PDPage object for that page number from that PDDocument object. It >> doesn't >> appear to reference the PDDocument in that method aside from getting the >> PDPage object. The PDPage is already independent. I can create a new >> document and pass it in to addPage(). >> >> I have an application that runs on a server which creates report page >> objects. Each page is serializable and can be pulled down to the client >> for a print preview. I'm using pdfbox on the server to read an existing >> PDF. I want to mix the pages of that PDF in with my report. I'd prefer >> not to wait for it to serialize the entire document to the client before >> they can preview one page. The original document object is irrelevant. >> The client will also have the option to print to the printer, which takes >> all the page objects and creates one Pageable object to print as a Book >> (which can be to a printer installed on the server or the client), or they >> can create a PDF. I'm currently drawing the pages >> to com.itextpdf.awt.PdfGraphics2D to create the PDF. I tried using FOP >> and >> it didn't recognize fonts correctly. >> >> PDFRenderer.renderPageToGraphics looks great, now I just want to separate >> the page from the document and be able to serialize it. Otherwise I have >> to go through this whole mess where my application has an array of pages >> and if they want to grab one page to view it I have to know if it came >> from >> a PDDocument, serialize the original PDF file, and recreate the whole >> document to show that one page. >> >> On Mon, Mar 2, 2015 at 5:29 PM, Tilman Hausherr >> wrote: >> >> Am 02.03.2015 um 22:49 schrieb Eric Douglas: >>> >>> Hi, I hope this is to the right place, my first time using this list. >>>> I'm working with a 2.0 maven trunk I found and I have a couple issues. >>>> I can't seem to find this class which is in some online javadocs >>>> referencing pdfbox 1.8: >>>> >>>> - org.apache.pdfbox.pdfviewer.PDFPagePanel >>>> >>>> org.apache.pdfbox.tools.gui.PDFPagePanel >>> >>> >>> Now, I'm trying to use pdfbox on a server to get pdf pages, then >>>> serialize >>>> one page at a time to render on a client. What's the best way to do >>>> this? >>>> >>>> none at all. You can't cut a PDF like a salami. There is the PDFSplit >>> application, but the size of all pages will be larger than the size of >>> the >>> original PDF, because of common objects. >>> >>> Tilman >>> >>> I'm trying to avoid serializing the entire document since the load >>> time is >>> >>>> much faster doing single pages, but PDPage is not serializable. >>>> org.apache.pdfbox.rendering.PDFRenderer accepts the document on the >>>> constructor but doesn't seem to need it to render a single page, other >>>> than >>>> to get the page from it in renderPageToGraphics which could easily add >>>> an >>>> overload to just accept the PDPage object. >>>> >>>> >>>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org >>> For additional commands, e-mail: users-help@pdfbox.apache.org >>> >>> >>> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org > For additional commands, e-mail: users-help@pdfbox.apache.org > > --f46d043893d75838a5051069090f--