1 22 package gnu.jpdf; 23 24 import java.io.*; 25 26 36 public class PDFInfo extends PDFObject 37 { 38 private String author; 39 private String creator; 40 private String title; 41 private String subject; 42 private String keywords; 43 44 47 public PDFInfo() { 48 super(null); 49 } 50 51 54 public PDFInfo(String title) { 55 this(); 56 this.title = title; 57 } 58 59 60 61 65 public String getAuthor() { 66 return author; 67 } 68 69 73 public void setAuthor(String v) { 74 this.author = v; 75 } 76 77 78 79 85 public String getCreator() { 86 return creator; 87 } 88 89 93 public void setCreator(String v) { 94 this.creator = v; 95 } 96 97 101 public String getTitle() { 102 return title; 103 } 104 105 109 public void setTitle(String v) { 110 this.title = v; 111 } 112 113 117 public String getSubject() { 118 return subject; 119 } 120 121 125 public void setSubject(String v) { 126 this.subject = v; 127 } 128 129 133 public String getKeywords() { 134 return keywords; 135 } 136 137 141 public void setKeywords(String v) { 142 this.keywords = v; 143 } 144 145 149 public void write(OutputStream os) throws IOException { 150 writeStart(os); 152 153 155 if(author!=null) { 156 os.write("/Author (".getBytes()); 157 os.write(PDFStringHelper.makePDFString(author).getBytes()); 158 os.write(")\n".getBytes()); 159 } 160 161 if(creator!=null) { 162 os.write("/Creator (".getBytes()); 163 os.write(PDFStringHelper.makePDFString(creator).getBytes()); 164 os.write(")\n".getBytes()); 165 } 166 167 os.write("/Producer ".getBytes()); 168 os.write(PDFStringHelper.makePDFString("gnujpdf - gnujpdf.sourceforge.net") 169 .getBytes()); 170 os.write("\n".getBytes()); 171 172 if(title!=null) { 173 os.write("/Title ".getBytes()); 174 os.write(PDFStringHelper.makePDFString(title).getBytes()); 175 os.write("\n".getBytes()); 176 } 177 178 if(subject!=null) { 179 os.write("/Subject (".getBytes()); 180 os.write(PDFStringHelper.makePDFString(subject).getBytes()); 181 os.write(")\n".getBytes()); 182 } 183 184 if(keywords!=null) { 185 os.write("/Keywords (".getBytes()); 186 os.write(PDFStringHelper.makePDFString(keywords).getBytes()); 187 os.write(")\n".getBytes()); 188 } 189 190 writeEnd(os); 192 } 194 } | Popular Tags |