Qualcuno ha idea di come inserire un immagine tramite PImage?
Sto cercando di inserire in un immagine, il contenuto di un pdf tramite lelibrerie di pdfbox, ho provato a fare una cosa del genere, ma non riessco ad inserire correttamente l'immagine:
codice:
JFrame testFrame = new JFrame("PDF Reader");
try {
PDDocument pddDocument=PDDocument.load(new File(b[table.getSelectedRow()].Percorso));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// PDDocument doc = null;
try
{
final PDPage page = (PDPage) doc.getDocumentCatalog().getAllPages().get(0);
PipedInputStream pis = new PipedInputStream();
final PipedOutputStream pos = new PipedOutputStream(pis);
BufferedImage bi = page.convertToImage(BufferedImage.TYPE_INT_ARGB, 120);
println("Conversion done");
PImage image = new PImage(bi);
image(image, 0, 0);
System.out.println("Conversion done");
}
catch (Exception e)
{
e.printStackTrace();
}
Toolkit t = Toolkit.getDefaultToolkit();
MediaTracker track = new MediaTracker(this);
track.addImage(image , 1); //errore
testFrame.setBounds(40, 40,100 ,100 );
testFrame.setVisible(true);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
setOpaque(false);
g.drawImage(bi, 0, 0, null);
}
Sto provando a prendere spunto da qua: http://forum.processing.org/one/topic/view-a-pdf.html
Ho aggiunto al filepath:
pdfbox 1.8.8
commons logging 1.2
fontbox 1.8.2
jempbox 1.8.2
Qualcuno ha idee?