| 1 20 package gnu.jpdf; 21 22 import java.awt.*; 23 import java.io.*; 24 import java.util.*; 25 26 35 public class PDFBorder extends PDFObject 36 { 37 43 44 47 private short style; 48 49 52 private double width; 53 54 57 private double dash[]; 58 59 68 public PDFBorder(short style,double width) { 69 super("/Border"); 70 this.style = style; 71 this.width = width; 72 } 73 74 80 public PDFBorder(double width,double dash[]) { 81 super("/Border"); 82 this.style = PDFAnnot.DASHED; 83 this.width = width; 84 this.dash = dash; 85 } 86 87 91 public void write(OutputStream os) throws IOException { 92 os.write(Integer.toString(objser).getBytes()); 94 os.write(" 0 obj\n".getBytes()); 95 96 os.write("[/S /".getBytes()); 97 os.write("SDBIU".substring(style,style+1).getBytes()); 98 os.write(" /W ".getBytes()); 99 os.write(Double.toString(width).getBytes()); 100 if(dash!=null) { 101 os.write(" /D [".getBytes()); 102 os.write(Double.toString(dash[0]).getBytes()); 103 for(int i=1;i<dash.length;i++) { 104 os.write(" ".getBytes()); 105 os.write(Double.toString(dash[i]).getBytes()); 106 } 107 os.write("] ".getBytes()); 108 } 109 os.write("]\n".getBytes()); 110 111 os.write("endobj\n".getBytes()); 113 } 114 } | Popular Tags |