VectorPaste is the first fully functional Java library for creating operating system specific vector images and their metadata and for saving and transferring that data into other applications. This library will significantly increase the quality and value of your products and allow you to increase revenue. Contact us today for information on licensing VectorPaste in your products.
Read this story for a demonstration of ChemDoodle using the VectorPaste library to seamlessly transfer scalable vector graphics into other applications like Microsoft Word.
VectorPaste is a fully functional Java library for creating operating system specific vector images and their metadata and for saving and transferring that data into other applications. Image metafiles are scalable vector images, meaning they remain crisp and clear at any size and resolution, as opposed to bitmap images (such as JPG, PNG and GIF) which lose their quality upon scaling. The supported protocols are the Macintosh PICT 2 vector format and Windows Enhanced Metafile (EMF).
Additionally, Java does not provide the functionality for handling image metafiles on the system clipboard, but VectorPaste provides a solution. VectorPaste allows you to transfer vector images from your Java application into almost any other application, including Microsoft Office, OpenOffice, iWork and Adobe Products (Photoshop, Illustrator, etc.) on Windows, Mac and Linux.
If you are developing or managing any application that generates 2D graphics, you will need to find a way to transfer those graphics in a vector format into other applications. We develop an application called ChemDoodle and spent years researching this issue and searching for solutions. VectorPaste is the first and only library created to allow Java applications to perform this functionality.
Why did you write VectorPaste?
We needed to be able to transfer vector graphics between our applications and third party applications. Since there were no options available, we wrote this library ourselves to perform this function.
Why are vector images important?
The most common image type is called a bitmap or raster image. This type of image defines a rectangular area of pixels with a color for each. When these images are scaled, rotated or transferred to a new medium with a different resolution (such as a printer), their quality degrades significantly. If you have ever pasted an image into Microsoft Word, and enlarged it only to see the image get blurry or pixellated, you are experiencing the shortcomings of bitmap images. Vector images are instead instructions for recreating an image based on drawing commands. These images remain crisp and clear regardless of any transformations or the resolution of the device they are being rendered on. VectorPaste only generates these superior images so you may paste your application’s graphics into other common applications like Word.
Why use VectorPaste over other vector graphics libraries like VectorGraphics, Batik or iText?
VectorPaste is a library for creating three such protocols: Macintosh PICT 2, Windows Enhanced Metafile (EMF), and Adobe PDF. VectorPaste is the only library in Java able to generate Macintosh PICT 2 vector format. Most importantly, VectorPaste is the ONLY library in Java with the functionality for transferring vector graphics into other applications. And lastly, VectorPaste gives you complete control over your images; you may use two distinct Graphics2D derivatives for each protocol or manually generate data by calling a Writer‘s record methods. Apache Batik can only generate SVG graphics, but it is a very well written library for that purpose. iText is a wonderful open source library that is unrivaled in its ability to produce PDF documents. VectorPaste uses iText to generate PDF for specific application compatibility. VectorGraphics generates EMF, but it has several bugs, and the project’s development was discontinued in 2007.
I’ve tried using Java to paste vector images into Microsoft Word, but it just doesn’t work. Will VectorPaste work?
Yes it will. Our scientists have provided a solution for Java applications to transfer vector images between applications. VectorPaste even provides static helper methods for saving images and posting data to the system clipboard to make your job as easy as possible.
VectorGraphics is Java 1.5+ compatible and adheres to the standards of Java 1.5. It is very easy to read, understand and use. It is commented according to the documentation of the supported protocols, and that documentation is provided with the package.
The general procedure a developer would follow when using VectorPaste is illustrated in the following image and explained in the following instructions.
- Create a Writer object for the specific protocol to be written, usually corresponding to the current operating system.
- Create the image.
- Manually generate the protocol by calling the Writer‘s methods for writing records, using the associated Diction and Objects resources to define content.
- Pass a Simulation Graphics object, that extends Graphics2D, from the writer to the drawing methods you have written for creating an exact representation of the graphics you would see displayed in a Swing Component.
- Pass an Efficient Graphics object, that extends Graphics2D, from the writer to the drawing methods you have written for generating the protocols using their most appropriate methods. The size of this data will be significantly smaller than for the corresponding Simulation Graphics data, but it may have a slightly different appearance in a different application due to a difference in that application’s interpretation of the protocol.
- Save the image to a file or output it to the system clipboard for transfer into a different application. VectorPaste contains static helper methods for these two processes.
The following image gives a visual layout of all the Classes provided in the VectorPaste library. The first column are the static helper methods that you will call to perform any functionality needed. If more fine tuned approaches are necessary such as manually creating metafile records or overriding methods, then you may explicitly create the writers. All writers have a pair of ScalableGraphics2D objects associated with them that are provided through method calls. These ScalableGraphics2D subclasses can be forwarded to already written Swing code to write Java Swing graphics to operating system specific image metafile formats.
Extent and Limitations
Partial List of Compatible Applications
All popular applications written should accept either EMF, PICT or PDF. The following list mentions only the most popular packages and applications.
- Microsoft Office
- Adobe Photoshop
- Adobe Illustrator
- EMF is the standard image metafile format on Windows platforms. EMF is also used in several popular packages on Linux, including OpenOffice.
- PICT was the standard image metafile format on Mac platforms, and has now been replaced by PDF. That being said, several popular applications, including Microsoft Office, still require PICT format.
- PICT Region objects are proprietary and are licensed by Apple. To reduce license costs, all polygons and shapes are simulated. This issue only affects PICTEfficientGraphics2D such that all polygons and shapes look like they would if described by PICTSimulationGraphics2D, which is exactly as they would appear in a Swing component.
- PDF is necessary for current generation Mac OSX applications, as PDF is now the specified metafile format for that platform. Microsoft Office still uses PICT though. All PDF generation in VectorPaste requires the inclusion of the open source iText package which we will provide. iText is licensed either through LGPL or MPL, depending on your choice.
VectorPaste is a commercial product and requires the purchase of a license. Contact us for more information. To see how VectorPaste would work in your products, please obtain a free trial copy of ChemDoodle, one of our products that uses VectorPaste. You will be able to paste vector images into other applications, then manipulate, rotate, and resize them, and witness for yourself the power of VectorPaste. The trial version of ChemDoodle employs watermarking to enforce trial restrictions. Watermarking is a programmable feature of the VectorPaste library and will be available for use in your products.
Summer 2009 (v1.0): Initial release.