GemBox.Pdf
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PdfFunction Class

    Namespace:
    GemBox.Pdf.Functions
    Assembly:
    GemBox.Pdf.dll

    PDF provides several types of function objects (PDF 1.2) that represent parameterized classes of functions, including mathematical formulas and sampled representations with arbitrary resolution.

    Functions in PDF represent static, self-contained numerical transformations.

    In general, a function can take any number (m) of input values and produce any number (n) of output values: f(x[0], ..., x[m-1]) = y[0], ..., y[n-1]

    In PDF functions, all the input values and all the output values shall be numbers, and functions shall have no side effects.

    • C#
    • VB.NET
    public abstract class PdfFunction : PdfObject
    Public MustInherit Class PdfFunction
        Inherits PdfObject
    Inheritance:
    System.Object
    PdfObject
    PdfFunction
    Derived
    PdfExponentialInterpolationFunction
    PdfPostScriptCalculatorFunction
    PdfSampledFunction
    PdfStitchingFunction
    Remarks

    Each function definition includes a Domain, the set of legal values for the input. Some types of functions also define a Range, the set of legal values for the output. Input values passed to the function shall be clipped to the Domain, and output values produced by the function shall be clipped to the Range.

    Properties

    Domain

    (Required) A collection of mPdfNumberRanges, where m shall be the number of input values. For each i from 0 to m − 1, Domain[i].First shall be less than or equal to Domain[i].Last, and the ith input value, x[i], shall lie in the interval Domain[i].First ≤ x[i] ≤ Domain[i].Last. Input values outside the declared domain shall be clipped to the nearest boundary value.

    • C#
    • VB.NET
    public PdfNumberRangeCollection Domain { get; set; }
    Public Property Domain As PdfNumberRangeCollection
    Property Value
    PdfNumberRangeCollection

    A collection of mPdfNumberRanges, where m shall be the number of input values.

    Exceptions
    System.ArgumentNullException

    Value is null.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.10 Functions'

    FunctionType

    Gets the type of the function.

    • C#
    • VB.NET
    public abstract PdfFunctionType FunctionType { get; }
    Public MustOverride ReadOnly Property FunctionType As PdfFunctionType
    Property Value
    PdfFunctionType

    The type of the function.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.10 Functions'

    Range

    (Required for PdfSampledFunctions and PdfPostScriptCalculatorFunctions, optional otherwise) A collection of nPdfNumberRanges, where n shall be the number of output values. For each j from 0 to n − 1, Range[j].First shall be less than or equal to Range[j].Last, and the jth output value, y[j] , shall lie in the interval Range[j].First ≤ y[j] ≤ Range[j].Last. Output values outside the declared range shall be clipped to the nearest boundary value. If this entry is absent, no clipping shall be done.

    • C#
    • VB.NET
    public PdfNumberRangeCollection Range { get; set; }
    Public Property Range As PdfNumberRangeCollection
    Property Value
    PdfNumberRangeCollection

    A collection of nPdfNumberRanges, where n shall be the number of output values.

    See Also
    PDF Specification ISO 32000-1:2008, section '7.10 Functions'

    Methods

    Compile()

    Compiles the PDF function described by this PdfFunction instance into executable code and produces a delegate that represents the PDF function.

    • C#
    • VB.NET
    public Action<double[], double[]> Compile()
    Public Function Compile As Action(Of Double(), Double())
    Returns
    System.Action<System.Double[], System.Double[]>

    A delegate of type System.Action<T1, T2> that represents the compiled PDF function described by this PdfFunction instance.

    Remarks

    The Compile() method produces a delegate of type System.Action<T1, T2> at runtime. When that delegate is executed, it has the behavior described by the semantics of this PdfFunction instance.

    The Compile() method can be used to obtain the value of any PDF function. First, create a PDF function by using any of the PdfFunction-derived types. Then call Compile() to obtain a delegate, and execute the delegate to obtain the value of the PDF function.

    Compile(Boolean)

    Compiles the PDF function described by this PdfFunction instance into executable code and produces a delegate that represents the PDF function.

    • C#
    • VB.NET
    public Func<double[], double[]> Compile(bool cacheOutput)
    Public Function Compile(cacheOutput As Boolean) As Func(Of Double(), Double())
    Parameters
    cacheOutput
    System.Boolean

    If set to true the output array is cached in the compiled form of a PDF function and used for subsequent calculations; otherwise, false to return a new output array instance for each calculation.

    Returns
    System.Func<System.Double[], System.Double[]>

    A delegate of type System.Func<T, TResult> that represents the compiled PDF function described by this PdfFunction instance.

    Remarks

    The Compile() method produces a delegate of type System.Func<T, TResult> at runtime. When that delegate is executed, it has the behavior described by the semantics of this PdfFunction instance.

    The Compile() method can be used to obtain the value of any PDF function. First, create a PDF function by using any of the PdfFunction-derived types. Then call Compile() to obtain a delegate, and execute the delegate to obtain the value of the PDF function.

    Inherited Properties

    Metadata

    (Optional; PDF 1.4) A metadata stream containing metadata for the component.

    (Inherited from PdfObject)

    Extension Methods

    PdfObjectExtensions.GetDictionary(PdfObject)
    PdfObjectExtensions.GetOrAddDictionary(PdfObject)
    PdfObjectExtensions.GetArray(PdfObject)

    See Also

    PdfFunctionType
    PdfSampledFunction
    PdfExponentialInterpolationFunction
    PdfStitchingFunction
    PdfPostScriptCalculatorFunction
    PDF Specification ISO 32000-1:2008, section '7.10 Functions'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.