pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Douglas <edoug...@blockhouse.com>
Subject Re: PDFBox 2.0
Date Tue, 03 Mar 2015 13:22:14 GMT
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 <THausherr@t-online.de>

> 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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message