1 45 package com.lowagie.text.pdf; 46 47 import com.lowagie.text.ExceptionConverter; 48 49 54 55 public class PdfPattern extends PdfStream { 56 57 PdfPattern(PdfPatternPainter painter) { 58 super(); 59 PdfNumber one = new PdfNumber(1); 60 PdfArray matrix = painter.getMatrix(); 61 if ( matrix != null ) { 62 put(PdfName.MATRIX, matrix); 63 } 64 put(PdfName.TYPE, PdfName.PATTERN); 65 put(PdfName.BBOX, new PdfRectangle(painter.getBoundingBox())); 66 put(PdfName.RESOURCES, painter.getResources()); 67 put(PdfName.TILINGTYPE, one); 68 put(PdfName.PATTERNTYPE, one); 69 if (painter.isStencil()) 70 put(PdfName.PAINTTYPE, new PdfNumber(2)); 71 else 72 put(PdfName.PAINTTYPE, one); 73 put(PdfName.XSTEP, new PdfNumber(painter.getXStep())); 74 put(PdfName.YSTEP, new PdfNumber(painter.getYStep())); 75 bytes = painter.toPdf(null); 76 put(PdfName.LENGTH, new PdfNumber(bytes.length)); 77 try { 78 flateCompress(); 79 } catch (Exception e) { 80 throw new ExceptionConverter(e); 81 } 82 } 83 } 84 | Popular Tags |