1 17 18 19 20 package org.apache.fop.pdf; 21 22 import java.io.IOException ; 23 24 import org.apache.commons.io.output.ByteArrayOutputStream; 25 26 30 public class PDFOutputIntent extends PDFObject { 31 32 33 public static final String GTS_PDFX = "GTS_PDFX"; 34 35 public static final String GTS_PDFA1 = "GTS_PDFA1"; 36 37 private String subtype; private String outputCondition; 39 private String outputConditionIdentifier; 40 private String registryName; 41 private String info; 42 private PDFICCStream destOutputProfile; 43 44 45 46 public String getSubtype() { 47 return subtype; 48 } 49 50 54 public void setSubtype(String subtype) { 55 this.subtype = subtype; 56 } 57 58 59 public String getOutputCondition() { 60 return outputCondition; 61 } 62 63 68 public void setOutputCondition(String outputCondition) { 69 this.outputCondition = outputCondition; 70 } 71 72 73 public String getOutputConditionIdentifier() { 74 return outputConditionIdentifier; 75 } 76 77 82 public void setOutputConditionIdentifier(String outputConditionIdentifier) { 83 this.outputConditionIdentifier = outputConditionIdentifier; 84 } 85 86 87 public String getRegistryName() { 88 return registryName; 89 } 90 91 97 public void setRegistryName(String registryName) { 98 this.registryName = registryName; 99 } 100 101 102 public String getInfo() { 103 return info; 104 } 105 106 111 public void setInfo(String info) { 112 this.info = info; 113 } 114 115 116 public PDFICCStream getDestOutputProfile() { 117 return destOutputProfile; 118 } 119 120 125 public void setDestOutputProfile(PDFICCStream destOutputProfile) { 126 this.destOutputProfile = destOutputProfile; 127 } 128 129 130 public byte[] toPDF() { 131 ByteArrayOutputStream bout = new ByteArrayOutputStream(128); 132 try { 133 bout.write(encode(getObjectID())); 134 bout.write(encode("<<\n")); 135 bout.write(encode("/Type /OutputIntent\n")); 136 137 bout.write(encode("/S /")); 138 bout.write(encode(this.subtype)); 139 bout.write(encode("\n")); 140 141 if (outputCondition != null) { 142 bout.write(encode("/OutputCondition ")); 143 bout.write(encodeText(this.outputCondition)); 144 bout.write(encode("\n")); 145 } 146 147 bout.write(encode("/OutputConditionIdentifier ")); 148 bout.write(encodeText(this.outputConditionIdentifier)); 149 bout.write(encode("\n")); 150 151 if (registryName != null) { 152 bout.write(encode("/RegistryName ")); 153 bout.write(encodeText(this.registryName)); 154 bout.write(encode("\n")); 155 } 156 157 if (info != null) { 158 bout.write(encode("/Info ")); 159 bout.write(encodeText(this.info)); 160 bout.write(encode("\n")); 161 } 162 163 if (destOutputProfile != null) { 164 bout.write(encode("/DestOutputProfile " + destOutputProfile.referencePDF() + "\n")); 165 } 166 167 bout.write(encode(">>\nendobj\n")); 168 } catch (IOException ioe) { 169 log.error("Ignored I/O exception", ioe); 170 } 171 return bout.toByteArray(); 172 } 173 174 175 } 176 | Popular Tags |