yext.export.io
Class PDFOutputHandler

java.lang.Object
  extended by y.io.IOHandler
      extended by yext.export.io.OutputHandler
          extended by yext.export.io.PDFOutputHandler

public class PDFOutputHandler
extends OutputHandler

Writes a Graph2D in PDF vector graphics format.

The size, viewport, and zoom level of the output will be determined by the Graph2DView associated with the input graph.

A PDFOutputHandler is used the same way as any other IOHandler. E.g. the simplest way to export a given Graph2D instance to PDF is:

 try {
   new PDFOutputHandler().write(graph2D, "myGraphAsPDF.pdf");
 } catch(IOException ex) {
   // error handling code
 }
 

See Also:
Graph2DView
 

Field Summary
static byte PLAIN_TEXT
          Text handling policy which will result in regular text (i.e. plain text glyphs).
static byte PLAIN_TEXT_WITH_EMBEDDED_FONTS
          Text handling policy which will result in regular text (i.e. plain text glyphs) and fonts used in labeled graph elements being embedded into the resulting PDF output.
static byte VECTORIZED_TEXT
          Text handling policy which will result in text being rendered as vectorized shapes instead of plain text glyphs.
static PageFormat VIEW_FORMAT
          Symbolic page format that may be used to create PDF documents for which the page size is determined by the size of the exported graph's view.
 
Constructor Summary
PDFOutputHandler()
          Creates a new instance of PDFOutputHandler
 
Method Summary
 String getFileNameExtension()
          Returns "pdf", the standard file name extension for the Portable Document Format.
 PageFormat getPageFormat()
          Returns a PageFormat object representing the desired page size and page orientation for this output handler.
 byte getTextRenderingPolicy()
          Returns the text handling policy used by this output handler.
 boolean isMultiPageTilingEnabled()
          Returns true, iff this output handler is configured to split content across multiple pages if necessary; false, if the page will be resized to accommodate the content.
 boolean isPageOutlinesEnabled()
          Determines whether or not this output handler automatically creates outlines (or "bookmarks") for each page in the generated document.
 void setMultiPageTilingEnabled(boolean multiPageTilingEnabled)
          Specifies whether this output handler should split content that does not fit onto a single page across multiple pages instead of automatically resizing the page to accommodate the content.
 void setPageFormat(PageFormat pageFormat)
          Specifies the desired page size and page orientation to be used in the generated PDF.
 void setPageOutlinesEnabled(boolean enabled)
          Specifies whether or not this output handler should automatically create outlines (or "bookmarks") for each page in the generated document.
 void setTextRenderingPolicy(byte textRenderingPolicy)
          Specifies the text handling policy to be used by this output handler.
 
Methods inherited from class yext.export.io.OutputHandler
addRenderingHint, canRead, canWrite, createDefaultGraph2DView, createGraphicsContext, getCreator, getFileFormatString, read, removeRenderingHint, setCreator, write
 
Methods inherited from class y.io.IOHandler
canWriteSubset, createObjectInputStream, createObjectOutputStream, hide, read, read, shouldSerialize, shouldSerialize, write, writeSubset, writeSubset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEW_FORMAT

public static final PageFormat VIEW_FORMAT
Symbolic page format that may be used to create PDF documents for which the page size is determined by the size of the exported graph's view.

Warning: This format is meant as a marker only and does not provide the usual PageFormat functionality. All of its PageFormat methods throw UnsupportedOperationException.

See Also:
setPageFormat(java.awt.print.PageFormat), getPageFormat()

PLAIN_TEXT

public static final byte PLAIN_TEXT
Text handling policy which will result in regular text (i.e. plain text glyphs).

See Also:
setTextRenderingPolicy(byte), PLAIN_TEXT_WITH_EMBEDDED_FONTS, VECTORIZED_TEXT, Constant Field Values

PLAIN_TEXT_WITH_EMBEDDED_FONTS

public static final byte PLAIN_TEXT_WITH_EMBEDDED_FONTS
Text handling policy which will result in regular text (i.e. plain text glyphs) and fonts used in labeled graph elements being embedded into the resulting PDF output.

Although font embedding ensures that the original graph element's label font can be used when displaying or printing PDF on a platform where that font is not normally available, it is not always advisable to embed fonts, e.g. when the size of the generated PDF needs to be kept as small as possible or when a font's license terms prohibit embedding.

See Also:
setTextRenderingPolicy(byte), PLAIN_TEXT, VECTORIZED_TEXT, Constant Field Values

VECTORIZED_TEXT

public static final byte VECTORIZED_TEXT
Text handling policy which will result in text being rendered as vectorized shapes instead of plain text glyphs.

Rendering text as vectorized shapes will result in smoothly scalable vector graphics and prevent the need for font embedding at the expense of generating output that is no PDF text and therefore cannot be selected as such.

See Also:
setTextRenderingPolicy(byte), PLAIN_TEXT, PLAIN_TEXT_WITH_EMBEDDED_FONTS, Constant Field Values
Constructor Detail

PDFOutputHandler

public PDFOutputHandler()
Creates a new instance of PDFOutputHandler

Method Detail

getFileNameExtension

public String getFileNameExtension()
Returns "pdf", the standard file name extension for the Portable Document Format.

Specified by:
getFileNameExtension in class IOHandler

getTextRenderingPolicy

public byte getTextRenderingPolicy()
Returns the text handling policy used by this output handler.

Returns:
the text handling policy used by this output handler.
See Also:
PLAIN_TEXT, PLAIN_TEXT_WITH_EMBEDDED_FONTS, VECTORIZED_TEXT

setTextRenderingPolicy

public void setTextRenderingPolicy(byte textRenderingPolicy)
Specifies the text handling policy to be used by this output handler.

Default to VECTORIZED_TEXT.

Parameters:
textRenderingPolicy - one of

isMultiPageTilingEnabled

public boolean isMultiPageTilingEnabled()
Returns true, iff this output handler is configured to split content across multiple pages if necessary; false, if the page will be resized to accommodate the content.

Returns:
true, iff this output handler is configured to split content across multiple pages if necessary; false, if the page will be resized to accommodate the content.

setMultiPageTilingEnabled

public void setMultiPageTilingEnabled(boolean multiPageTilingEnabled)
Specifies whether this output handler should split content that does not fit onto a single page across multiple pages instead of automatically resizing the page to accommodate the content.

Defaults to false.

Parameters:
multiPageTilingEnabled - iff true, content will be split across multiple pages if necessary; otherwise, the page will be resized to accommodate the content

isPageOutlinesEnabled

public boolean isPageOutlinesEnabled()
Determines whether or not this output handler automatically creates outlines (or "bookmarks") for each page in the generated document.

Returns:
true if this output handler automatically creates outlines for each page in the generated document; false otherwise.

Defaults to true.

See Also:
setPageOutlinesEnabled(boolean)

setPageOutlinesEnabled

public void setPageOutlinesEnabled(boolean enabled)
Specifies whether or not this output handler should automatically create outlines (or "bookmarks") for each page in the generated document.

Defaults to true.

Parameters:
enabled - if true, a bookmark for each page in the generated document is created; otherwise, no bookmarks are created.
See Also:
isPageOutlinesEnabled()

getPageFormat

public PageFormat getPageFormat()
Returns a PageFormat object representing the desired page size and page orientation for this output handler.

Returns:
a PageFormat object representing the desired page size and page orientation for this output handler.

setPageFormat

public void setPageFormat(PageFormat pageFormat)
Specifies the desired page size and page orientation to be used in the generated PDF. The desired page size may be ignored if the output contents do not fit into a correspondingly sized and oriented rectangle.

Use VIEW_FORMAT as page format to create PDF documents for which the page size is determined by the size of the exported graph's view.

Parameters:
pageFormat - a PageFormat object representing the desired page size and page orientation


© Copyright 2007-2015,
yWorks GmbH.
All rights reserved.