org.foray.pdf.object
Class PdfXFormMath

java.lang.Object
  extended by org.foray.pdf.object.PDFObject
      extended by org.foray.pdf.object.PDFStream
          extended by org.foray.pdf.object.PDFXObject
              extended by org.foray.pdf.object.PDFXForm
                  extended by org.foray.pdf.object.PdfXFormMath

public class PdfXFormMath
extends PDFXForm

A PDF "Form" XObject containing a MathML document.


Field Summary
 
Fields inherited from class org.foray.pdf.object.PDFObject
EOL, MSG_EOL, XREF_EOL
 
Constructor Summary
PdfXFormMath(PDFDocument doc, org.axsl.graphic.MathGraphic graphic, org.axsl.font.FontConsumer fontConsumer, boolean strokeText)
          Constructor.
 
Method Summary
protected  org.axsl.ps.PsBoundingBox getBoundingBox()
          Returns the bounding box dimensions, in form space, for this graphic.
 org.axsl.graphic.MathGraphic getGraphic()
          Return the encapsulated graphic.
 float getHorizontalScaling(Rectangle2D.Float contentRectangle)
          Returns the horizontal scaling factor that should be used for a specific "Do" for a specific content rectangle.
protected  byte[] getPdfContent()
          Converts the graphic content to PDF content.
protected  AffineTransform getUserSpaceTransform()
          Return the transformation that should be used to convert this form from form space to user space.
 float getVerticalScaling(Rectangle2D.Float contentRectangle)
          Returns the vertical scaling factor that should be used for a specific "Do" for a specific content rectangle.
protected  String specialXFormDict()
          Returns any special entries that should be added to the XForm dictionary.
 
Methods inherited from class org.foray.pdf.object.PDFXForm
specialXObjectDictEntries, xObjectContent, xObjectSubtype
 
Methods inherited from class org.foray.pdf.object.PDFXObject
addStreamFilters, finalizeStreamContent, getXObjectName, makeXObject, specialStreamDictEntries
 
Methods inherited from class org.foray.pdf.object.PDFStream
add, addDefaultFilters, addEncryption, addFilter, addFilter, applyFilters, getDataLength, getOutputStream, output, outputStreamData, setData, setOutputStream, toPDF
 
Methods inherited from class org.foray.pdf.object.PDFObject
bufferToByteArray, byteArrayToStream, getCharsPerLine, getGeneration, getLogger, getNumber, getPDFDocument, pdfID, pdfReference, setNumber, stringToByteArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdfXFormMath

public PdfXFormMath(PDFDocument doc,
                    org.axsl.graphic.MathGraphic graphic,
                    org.axsl.font.FontConsumer fontConsumer,
                    boolean strokeText)
             throws org.axsl.graphic.GraphicException
Constructor.

Parameters:
doc - The parent PDF document.
graphic - The form to be encapsulated.
fontConsumer - The font consumer to use for resolving fonts in the SVG.
strokeText - Set to true if text should be stroked, false if it should be drawn with a font.
Throws:
org.axsl.graphic.GraphicException - For errors getting the appropriate filter.
Method Detail

getPdfContent

protected byte[] getPdfContent()
                        throws org.axsl.graphic.GraphicException
Description copied from class: PDFXForm
Converts the graphic content to PDF content.

Specified by:
getPdfContent in class PDFXForm
Returns:
The PDF content.
Throws:
org.axsl.graphic.GraphicException - For errors during conversion.

getHorizontalScaling

public float getHorizontalScaling(Rectangle2D.Float contentRectangle)
Description copied from class: PDFXObject
Returns the horizontal scaling factor that should be used for a specific "Do" for a specific content rectangle. This is used in transformations that are outside the actual XObject definition, so that the XObject can be reused in other places, using different content rectangles. This abstraction is needed because bitmapped graphics are specified in image space, and XForm graphics (SVG and EPS) are specified in form space, which require radically different scaling mechanisms.

Specified by:
getHorizontalScaling in class PDFXObject
Parameters:
contentRectangle - The content rectangle into which the graphic will be scaled.
Returns:
The horizontal scaling factor that should be applied to this graphic when converting from its native space to user space.

getVerticalScaling

public float getVerticalScaling(Rectangle2D.Float contentRectangle)
Description copied from class: PDFXObject
Returns the vertical scaling factor that should be used for a specific "Do" for a specific content rectangle. See PDFXObject.getHorizontalScaling(java.awt.geom.Rectangle2D.Float) for an explanation of the need for this computation.

Specified by:
getVerticalScaling in class PDFXObject
Parameters:
contentRectangle - The content rectangle into which the graphic will be scaled.
Returns:
The vertical scaling factor that should be applied to this graphic when converting from its native space to user space.

getGraphic

public org.axsl.graphic.MathGraphic getGraphic()
Description copied from class: PDFXObject
Return the encapsulated graphic.

Specified by:
getGraphic in class PDFXObject
Returns:
The graphic.

getBoundingBox

protected org.axsl.ps.PsBoundingBox getBoundingBox()
Description copied from class: PDFXForm
Returns the bounding box dimensions, in form space, for this graphic.

Specified by:
getBoundingBox in class PDFXForm
Returns:
The bounding box for this graphic.

specialXFormDict

protected String specialXFormDict()
Description copied from class: PDFXForm
Returns any special entries that should be added to the XForm dictionary.

Specified by:
specialXFormDict in class PDFXForm
Returns:
Special XForm dictionary entries.

getUserSpaceTransform

protected AffineTransform getUserSpaceTransform()
Description copied from class: PDFXForm
Return the transformation that should be used to convert this form from form space to user space.

Specified by:
getUserSpaceTransform in class PDFXForm
Returns:
The transformation to be used to convert this form to user space.


Copyright © 2017. All rights reserved.