This code loads the pdf "test.pdf" and saves every page as a PNG file.

If you want to show the page on screen you could use the method pdfRenderer.renderPageToGraphics() instead.



public void extractPages() throws IOException
{
    String pdfFilename = "test";

    PDDocument document = PDDocument.load(new File(pdfFilename+".pdf"));
    PDFRenderer pdfRenderer = new PDFRenderer(document);
    for (int pageNo=0; pageNo < document.getNumberOfPages(); pageNo++)
    {
BufferedImage bim = pdfRenderer.renderImageWithDPI(pageNo, 300, ImageType.RGB);

        // suffix in filename will be used as the file format
ImageIOUtil.writeImage(bim, pdfFilename + "-" + (pageNo++) + ".png", 300);
    }
    document.close();
}



Kind regards
Daniel



2015-12-29 02:02 skrev Nakul Malhotra:
How do you use pdfbox to extract?!!?

On Mon, Dec 28, 2015 at 8:02 PM, <[email protected]> wrote:

Thanks!



2015-12-28 08:44 skrev Tilman Hausherr:

Am 28.12.2015 um 04:40 schrieb [email protected]:

Hi,

I have read this document about creating a valid PDF/A document:

https://pdfbox.apache.org/1.8/cookbook/pdfacreation.html

The problem is that it is written for PDFBOX 1.8 and I cannot get it to work for PDFBOX 2.0. I have searched the example folder but haven't been able to find an example or any other documentation on how to create a valid
PDF/A document.


It is in
examples\src\main\java\org\apache\pdfbox\examples\pdmodel\CreatePDFA.java
in the ZIP file:

....


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to