This page is from the outdated yFiles for Java 2.13 documentation. You can find the most up-to-date documentation for all yFiles products on the yFiles documentation overview page.
Please see the following links for more information about the yFiles product family of diagramming programming libraries and corresponding yFiles products for modern web apps, for cross-platform Java(FX) applications, and for applications for the Microsoft .NET environment.
Class
OutputHandler from the
extension package is the base class for all vector graphics file formats.
It provides a common basis for the yExport output handlers that enhance the
yFiles library.
OutputHandler is a direct subclass of abstract class
IOHandler
from package
y.io
of the yFiles
library.
Figure 12.1, “Output handler hierarchy in yExport” illustrates the yExport output handler
hierarchy.
The code fragment in Example 12.1, “Instantiating a PDFOutputHandler” shows how to
instantiate and use a PDFOutputHandler to export the content of a given
Graph2DView to a PDF-encoded file.
Example 12.1. Instantiating a PDFOutputHandler
public void exportPDF(Graph2DView view) { // Instantiate a PDF output handler and export the view's content. try { IOHandler ioh = new PDFOutputHandler(); ioh.write(view.getGraph2D(), "MyPDF.pdf"); } catch (IOException ioEx) { // Something went wrong. Complain. } }
PDFExportDemo.java presents an extensive tutorial demo application that shows how to export a view's contents to PDF.
Class OutputHandler supports passing rendering hints to the underlying rendering system. Rendering hints can be used to control the quality of text rendering, for example. The following method allows to specify the hints:
void addRenderingHint(RenderingHints.Key key, Object value) |
|
Description | Sets rendering hints for the rendering system. |
Class
VisualTransferable
makes available support for the system clipboard.
It allows to transfer the contents of a Graph2DView to the clipboard using the
EMF file format.
In addition to this so-called "data flavor," optional image file formats can
also be part of the transfer data in order to support EMF-unaware applications.
The additional image file formats that are used as fallback data flavors depend
on the actual platform as well as the version of the Java Runtime Environment.
The
VisualTransferable(Graph2DView, boolean)
constructor can be used to enable fallback data flavors as part of the
transferred data.
Tutorial demo application SystemClipboardDemo.java shows how to copy the contents of a Graph2DView encoded in EMF format to the system clipboard.
Copyright ©2004-2016, yWorks GmbH. All rights reserved. |