Outputs the contents of the EPS document to the specified Writer, complete with headers and bounding box.
(Writer writer)
| 138 | * Writer, complete with headers and bounding box. |
| 139 | */ |
| 140 | public synchronized void write(Writer writer) throws IOException { |
| 141 | float offsetX = -minX; |
| 142 | float offsetY = -minY; |
| 143 | writer.write("%!PS-Adobe-3.0 EPSF-3.0\n"); //$NON-NLS-1$ |
| 144 | writer.write("%%Creator: EpsGraphics2D "+EpsGraphics2D.VERSION+" by Paul Mutton, http://www.jibble.org/\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 145 | writer.write("%%Title: "+_title+"\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 146 | writer.write("%%CreationDate: "+new Date()+"\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 147 | writer.write("%%BoundingBox: 0 0 "+((int) Math.ceil(maxX+offsetX))+" "+((int) Math.ceil(maxY+offsetY))+"\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 148 | writer.write("%%DocumentData: Clean7Bit\n"); //$NON-NLS-1$ |
| 149 | writer.write("%%DocumentProcessColors: Black\n"); //$NON-NLS-1$ |
| 150 | writer.write("%%ColorUsage: Color\n"); //$NON-NLS-1$ |
| 151 | writer.write("%%Origin: 0 0\n"); //$NON-NLS-1$ |
| 152 | writer.write("%%Pages: 1\n"); //$NON-NLS-1$ |
| 153 | writer.write("%%Page: 1 1\n"); //$NON-NLS-1$ |
| 154 | writer.write("%%EndComments\n\n"); //$NON-NLS-1$ |
| 155 | writer.write("gsave\n"); //$NON-NLS-1$ |
| 156 | if(_stringWriter!=null) { |
| 157 | writer.write(offsetX+" "+(offsetY)+" translate\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 158 | _bufferedWriter.flush(); |
| 159 | StringBuffer buffer = _stringWriter.getBuffer(); |
| 160 | for(int i = 0; i<buffer.length(); i++) { |
| 161 | writer.write(buffer.charAt(i)); |
| 162 | } |
| 163 | writeFooter(writer); |
| 164 | } else { |
| 165 | writer.write(offsetX+" "+((maxY-minY)-offsetY)+" translate\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 166 | } |
| 167 | writer.flush(); |
| 168 | } |
| 169 | |
| 170 | private void writeFooter(Writer writer) throws IOException { |
| 171 | writer.write("grestore\n"); //$NON-NLS-1$ |
no test coverage detected