You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Hong-Thai Nguyen <hn...@customermatrix.com> on 2014/08/04 18:11:02 UTC
Load only 1 page of PDF Document
Hi all,
Is there a possibility to load only 1 page of PDF document to PDPage ?
Thanks,
Hong-Thai
Re: Load only 1 page of PDF Document
Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,
Parsing always goes through the whole document and load the structure.
But rendering will only render (and use additional space for images) the
page itself.
Tilman
Am 05.08.2014 10:29, schrieb Hong-Thai Nguyen:
> Thank Tilman for reply.
>
> I want to load only 1st page of a PDFDocument in order to generate its thumbnail:
> PDDocument document = PDDocument.loadNonSeq(localFile, null);
> PDPage page = (PDPage) document.getDocumentCatalog().getAllPages().get(0);
> try {
> BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_RGB, resolution);
> return image;
> } finally {
> page = null;
> }
>
> I'm interesting only the 1st page but I need to load all pages of documents, that's not really optimize on big documents.
> My question is: is there a possibility to build PDDocument with a PDPage of 1st page only ?
>
> Regards,
>
> Hong-Thai
>
> -----Message d'origine-----
> De : Tilman Hausherr [mailto:THausherr@t-online.de]
> Envoyé : lundi 4 août 2014 20:11
> À : dev@pdfbox.apache.org
> Objet : Re: Load only 1 page of PDF Document
>
> It is news to me that you can load several pages in one PDPage object.
> Are you sure you're writing about PDFBox?
>
> Tilman
>
> Am 04.08.2014 18:11, schrieb Hong-Thai Nguyen:
>> Hi all,
>>
>> Is there a possibility to load only 1 page of PDF document to PDPage ?
>>
>> Thanks,
>>
>> Hong-Thai
>>
>>
RE: Load only 1 page of PDF Document
Posted by Hong-Thai Nguyen <hn...@customermatrix.com>.
Thank Tilman for reply.
I want to load only 1st page of a PDFDocument in order to generate its thumbnail:
PDDocument document = PDDocument.loadNonSeq(localFile, null);
PDPage page = (PDPage) document.getDocumentCatalog().getAllPages().get(0);
try {
BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_RGB, resolution);
return image;
} finally {
page = null;
}
I'm interesting only the 1st page but I need to load all pages of documents, that's not really optimize on big documents.
My question is: is there a possibility to build PDDocument with a PDPage of 1st page only ?
Regards,
Hong-Thai
-----Message d'origine-----
De : Tilman Hausherr [mailto:THausherr@t-online.de]
Envoyé : lundi 4 août 2014 20:11
À : dev@pdfbox.apache.org
Objet : Re: Load only 1 page of PDF Document
It is news to me that you can load several pages in one PDPage object.
Are you sure you're writing about PDFBox?
Tilman
Am 04.08.2014 18:11, schrieb Hong-Thai Nguyen:
> Hi all,
>
> Is there a possibility to load only 1 page of PDF document to PDPage ?
>
> Thanks,
>
> Hong-Thai
>
>
Re: Load only 1 page of PDF Document
Posted by Tilman Hausherr <TH...@t-online.de>.
It is news to me that you can load several pages in one PDPage object.
Are you sure you're writing about PDFBox?
Tilman
Am 04.08.2014 18:11, schrieb Hong-Thai Nguyen:
> Hi all,
>
> Is there a possibility to load only 1 page of PDF document to PDPage ?
>
> Thanks,
>
> Hong-Thai
>
>