Transforming pdf to image
in
Contributed Library Questions
•
1 month ago
Well, I'm trying to use pdfbox to create a image trough a pdf file.
There only a few codes of this on the web and almost all of then have some problems, so I can't have a good reference.
Here's is my code:
//lots of import
void setup() {
size(200, 200);
}
void draw()
{
PDDocument pdf = null;
pdf = PDDocument.load(new File("C:\\Users\\Pedrog\\Documents\\Processing\\pdfConvert\\testing.pdf"));
PDFImageWriter imageWriter = new PDFImageWriter();
imageWriter.writeImage(pdf, "png", "", 1, 10, "imagemPdf");
}
But I keep reciving IOException on load function, I checked the library reference and they say that happens when:
I've already checked the path, the file name and executed processing as admin but nothing helped me.
Can someone give me any ideas?
Thank you.
There only a few codes of this on the web and almost all of then have some problems, so I can't have a good reference.
Here's is my code:
//lots of import
void setup() {
size(200, 200);
}
void draw()
{
PDDocument pdf = null;
pdf = PDDocument.load(new File("C:\\Users\\Pedrog\\Documents\\Processing\\pdfConvert\\testing.pdf"));
PDFImageWriter imageWriter = new PDFImageWriter();
imageWriter.writeImage(pdf, "png", "", 1, 10, "imagemPdf");
}
But I keep reciving IOException on load function, I checked the library reference and they say that happens when:
"
If there is an error reading from the stream.". (
http://pdfbox.apache.org/apidocs/org/apache/pdfbox/pdmodel/PDDocument.html#load%28java.io.File%29)
I've already checked the path, the file name and executed processing as admin but nothing helped me.
Can someone give me any ideas?
Thank you.
1