1 51 package org.apache.fop.pdf; 52 53 import java.io.UnsupportedEncodingException ; 55 56 public class PDFTTFStream extends PDFStream { 57 private int origLength; 58 59 public PDFTTFStream(int num, int len) { 60 super(num); 61 origLength = len; 62 } 63 64 protected int output(java.io.OutputStream stream) 67 throws java.io.IOException { 68 int length = 0; 69 String filterEntry = applyFilters(); 70 String preData = new String (this.number + " " + this.generation 71 + " obj\n<< /Length " 72 + (_data.size() + 1) + " " + filterEntry 73 + " " + "/Length1 " + origLength 74 + " >>\n"); 75 76 byte[] p; 77 try { 78 p = preData.getBytes(PDFDocument.ENCODING); 79 } catch (UnsupportedEncodingException ue) { 80 p = preData.getBytes(); 81 } 82 83 stream.write(p); 84 length += p.length; 85 86 length += outputStreamData(stream); 87 try { 88 p = "endobj\n".getBytes(PDFDocument.ENCODING); 89 } catch (UnsupportedEncodingException ue) { 90 p = "endobj\n".getBytes(); 91 } 92 stream.write(p); 93 length += p.length; 94 return length; 95 } 96 97 public void setData(byte[] data, int size) throws java.io.IOException { 98 _data.reset(); 99 _data.write(data, 0, size); 101 } 102 103 } 104 | Popular Tags |