| 1 17 18 19 20 package org.apache.fop.pdf; 21 22 import java.io.IOException ; 24 import java.io.OutputStream ; 25 26 32 public class PDFFormXObject extends PDFXObject { 33 private PDFStream contents; 34 private String resRef; 35 36 44 public PDFFormXObject(int xnumber, PDFStream cont, String ref) { 45 super(xnumber, null); 46 contents = cont; 47 resRef = ref; 48 } 49 50 59 protected int output(OutputStream stream) throws IOException { 60 int length = 0; 61 62 String dictEntries = getFilterList().buildFilterDictEntries(); 63 64 final StreamCache encodedStream = encodeStream(); 65 66 StringBuffer sb = new StringBuffer (128); 67 sb.append(getObjectID()); 68 sb.append("<</Type /XObject\n"); 69 sb.append("/Subtype /Form\n"); 70 sb.append("/FormType 1\n"); 71 sb.append("/BBox [0 0 1000 1000]\n"); 72 sb.append("/Matrix [1 0 0 1 0 0]\n"); 73 sb.append("/Resources " + resRef + "\n"); 74 sb.append("/Length " + (encodedStream.getSize() + 1) + "\n"); 75 76 sb.append(dictEntries); 77 sb.append(">>\n"); 78 79 byte[] pdfBytes = encode(sb.toString()); 81 stream.write(pdfBytes); 82 length += pdfBytes.length; 83 84 length += outputStreamData(encodedStream, stream); 86 encodedStream.clear(); 88 pdfBytes = encode("endobj\n"); 89 stream.write(pdfBytes); 90 length += pdfBytes.length; 91 92 contents = null; 96 return length; 97 } 98 99 102 protected void outputRawStreamData(OutputStream out) throws IOException { 103 contents.outputRawStreamData(out); 104 } 105 106 107 } 108 109 | Popular Tags |