1 50 51 package com.lowagie.text.pdf.codec.postscript; 52 53 import java.io.*; 54 import java.awt.*; 55 import com.lowagie.text.*; 56 import com.lowagie.text.pdf.*; 57 58 public class MetaDoPS { 59 60 public PdfContentByte cb; 61 InputStream in; 62 int left; 63 int top; 64 int right; 65 int bottom; 66 int inch; 67 68 public MetaDoPS(InputStream in, PdfContentByte cb) { 69 this.cb = cb; 70 this.in = in; 71 } 72 73 public void readAll() throws IOException, DocumentException { 74 75 cb.saveState(); 76 java.awt.Graphics2D g2 = cb.createGraphicsShapes(PageSize.A4. 77 width(), PageSize.A4.height()); 78 try { 79 PAContext context = new PAContext( (Graphics2D) g2, 80 new Dimension( (int) PageSize.A4.width(), 81 (int) PageSize.A4.height())); 82 context.draw(new BufferedInputStream(in)); 83 in.close(); 85 } 86 catch (IOException ex) { 87 ex.printStackTrace(); 88 } 89 catch (PainterException ex) { 90 ex.printStackTrace(); 91 } 92 93 cb.restoreState(); 94 95 } 96 97 } 98 | Popular Tags |