yext.export.io
Class PDFOutputHandler

java.lang.Object
  extended byy.io.IOHandler
      extended byyext.export.io.OutputHandler
          extended byyext.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.
 
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 accomodate the content.
 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 accomodate the content.
 void setPageFormat(PageFormat pageFormat)
          Specifies the desired page size and page orientation to be used in the generated PDF.
 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, 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

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.


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 accomodate 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 accomodate 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 accomodate 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 accomodate the content

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.

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


© Copyright 2007,
yWorks GmbH.
All rights reserved.