Every format registers itself as an ExportFileType with a lookup service, so that
a program can find ExportFileTypes for a particular format.
The registration is done by scanning each of the jar files on the
classpath for the file
This file contains the names of all the ExportFileTypes it should
register, normally only one per jar file, but sometimes more, in the case of
PS and EPS for instance.
If you merge all the jar files into one, you should also make
META-INF/services/org.freehep.util.export.ExportFileType file with
ALL the formats in it.
Indeed in PostScript and PDF one can only reduce the clipping region. VectorGraphics has no protection for you setting a larger region and exporting to PostScript or PDF. However, both format can save the graphics state, reduce the clipping region and then restore the graphics state (including the initially larger clipping region).
You do not have direct control over save/restore, but creating a sub-graphics context is used to do a save/restore, as shown in the code below:
... large (or no) clipping exists in context g. Graphics2D tempg = g.create(); tempg.clipRect(100, 100, 200, 200); ... draw stuff with smaller clipping tempg.dispose(); ... large (or no) clipping exists in context g.
Note that it is important to call
tempg.dispose(); at the end, otherwise the
newly created graphics object will remain as a memory leak.