gnujpdf reformat

This commit is contained in:
Jindra Petřík
2021-02-20 10:01:49 +01:00
parent 7eb151055b
commit df913281dc
24 changed files with 3587 additions and 3574 deletions

View File

@@ -1,6 +1,5 @@
package gnu.jpdf;
import gnu.jpdf.PDFJob;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
@@ -10,31 +9,30 @@ import java.io.File;
import java.io.FileOutputStream;
import javax.imageio.ImageIO;
/**
*
* @author JPEXS
*/
public class Test {
public static void main(String[] args) throws Exception {
PDFJob job=new PDFJob(new FileOutputStream("test.pdf"));
PageFormat pf=new PageFormat();
PDFJob job = new PDFJob(new FileOutputStream("test.pdf"));
PageFormat pf = new PageFormat();
pf.setOrientation(PageFormat.PORTRAIT);
Paper p = new Paper();
p.setSize(210,297); //A4
p.setSize(210, 297); //A4
pf.setPaper(p);
BufferedImage img = ImageIO.read(new File("earth.jpg"));
int w = 200;
for(int i=0;i<10;i++){
for (int i = 0; i < 10; i++) {
Graphics g = job.getGraphics();
g.drawImage(img, 0, 0,w,w, null);
g.drawImage(img, 0, 0, w, w, null);
g.dispose();
}
job.end();
}
}