1 51 package org.apache.fop.pdf; 52 53 import java.io.UnsupportedEncodingException ; 55 56 import org.apache.fop.fonts.type1.PFBData; 58 59 public class PDFT1Stream extends PDFStream { 60 61 private PFBData pfb; 62 63 public PDFT1Stream(int num) { 64 super(num); 65 } 66 67 68 protected int output(java.io.OutputStream stream) 71 throws java.io.IOException { 72 if (pfb == null) throw new NullPointerException ("pfb must not be null at this point"); 73 int length = 0; 74 String filterEntry = applyFilters(); 75 String preData = this.number + " " + this.generation 76 + " obj\n<< /Length " + getDataLength() + " " 77 + filterEntry 78 + " /Length1 " + pfb.getLength1() 79 + " /Length2 " + pfb.getLength2() 80 + " /Length3 " + pfb.getLength3() + " >>\n"; 81 82 byte[] p; 83 try { 84 p = preData.getBytes(PDFDocument.ENCODING); 85 } catch (UnsupportedEncodingException ue) { 86 p = preData.getBytes(); 87 } 88 89 stream.write(p); 90 length += p.length; 91 92 length += outputStreamData(stream); 93 try { 94 p = "endobj\n".getBytes(PDFDocument.ENCODING); 95 } catch (UnsupportedEncodingException ue) { 96 p = "endobj\n".getBytes(); 97 } 98 stream.write(p); 99 length += p.length; 100 return length; 102 } 103 104 public void setData(PFBData pfb) throws java.io.IOException { 105 _data.reset(); 106 this.pfb = pfb; 108 pfb.outputAllParts(_data); 109 } 110 111 } 112 | Popular Tags |