import { ObjectManager } from "../ObjectManager"; import { type PdfPage } from "./PdfPage"; import type { Rect } from "../Types"; import { DocAction } from "./DocAction"; /** * Describes a particular view of a document. * * Defines a particular view of a document. * A destination consists of: * The page of the document to be displayed. * The location of the document window on that page. * The magnification (zoom factor) to use when displaying the page. * * Important note about vertical coordinates: * In PDFs, all coordinates are specified relative to the bottom left corner, * with the Y axis going up. * DsPdfJS uses the more common coordinate system with the origin * in the top left corner, with the Y axis going down. * In most situations the Y coordinates are automatically converted by DsPdfJS. * In classes derived from {@link Destination} this is also done if * the destination's target page is specified as the {@link PdfPage} * object. * But if the destination's target page is specified by index, * automatic conversion of the Y coordinate cannot be done, and it should be * specified relative to the bottom left corner as per the PDF spec. * * When the Y coordinate is specified relative to the page bottom, * it is noted in the parameter's description. * (It is recommended that constructors accepting a {@link PdfPage} object * are used instead.) * * All properties defining the Y coordinate has linked property with "Pdf" prefix, * for example Y and PdfY, the property with "Pdf" prefix contains a value relative to the * bottom left corner with the Y axis going up. * @see {@link Destination} */ export type DestinationPropertiesBase = { /** * The target page index. * Note the {@link DestinationPropertiesBase#pageIndex} or {@link DestinationPropertiesBase#page} should be specified, * if both are specified then {@link DestinationPropertiesBase#page} is preffered. */ pageIndex?: number; /** * The target page. * Note the {@link DestinationPropertiesBase#pageIndex} or {@link DestinationPropertiesBase#page} should be specified, * if both are specified then {@link DestinationPropertiesBase#page} is preffered. */ page?: PdfPage; }; /** * Display the page designated by {@link DestinationPropertiesBase#page}, with the coordinates (left, top) positioned at the upper-left corner * of the window and the contents of the page magnified by the factor zoom. * A null value for any of the parameters left, top, or zoom specifies that the current value * of that parameter is to be retained unchanged. A zoom value of 0 has the same meaning as a null value. * @see {@link DestinationXYZ} */ export type DestinationXYZProperties = DestinationPropertiesBase & { type: 'xyz'; /** * The left coordinate of the document window, if null then unchanged. */ left?: number; /** * The top coordinate of the document window, if null then unchanged. * * It should be specified relative to the top left corner if page specified * relative using {@link DestinationPropertiesBase#page} or relative to the bottom left corner * if page specified using {@link DestinationPropertiesBase#pageIndex}. * See {@link Destination} description for details. */ top?: number; /** * The zoom factor of the document window, unchanged if null or zero. */ zoom?: number; }; /** * Display the page designated by {@link DestinationPropertiesBase#page}, with its contents magnified just enough to fit the entire page * within the window both horizontally and vertically. * If the required horizontal and vertical magnification factors are different, use the smaller of the two, * centering the page within the window in the other dimension. * @see {@link DestinationFit} */ export type DestinationFitProperties = DestinationPropertiesBase & { type: 'fit'; }; /** * Display the page designated by {@link DestinationPropertiesBase#page}, with the vertical coordinate top positioned at the top edge of the window * and the contents of the page magnified just enough to fit the entire width of the page within the window. * A null value for top specifies that the current value of that parameter is to be retained unchanged. * @see {@link DestinationFitH} */ export type DestinationFitHProperties = DestinationPropertiesBase & { type: "fith"; /** * The top coordinate of the document window, if null then unchanged. * * It should be specified relative to the top left corner if page specified * relative using {@link DestinationPropertiesBase#page} or relative to the bottom left corner * if page specified using {@link DestinationPropertiesBase#pageIndex}. * See {@link Destination} description for details. */ top?: number; }; /** * Display the page designated by {@link DestinationPropertiesBase#page}, with the horizontal coordinate left positioned at the left edge of the window * and the contents of the page magnified just enough to fit the entire height of the page within the window. * A null value for left specifies that the current value of that parameter is to be retained unchanged. * @see {@link DestinationFitV} */ export type DestinationFitVProperties = DestinationPropertiesBase & { type: "fitv"; /** * The left coordinate of the document window, if null then unchanged. */ left?: number; }; /** * Display the page designated by {@link DestinationPropertiesBase#page}, with its contents magnified just enough to fit the rectangle * specified by the coordinates left, bottom, right, and top entirely within the window both horizontally and vertically. * If the required horizontal and vertical magnification factors are different, use the smaller of the two, * centering the rectangle within the window in the other dimension. * @see {@link DestinationFitR} */ export type DestinationFitRProperties = DestinationPropertiesBase & { type: "fitr"; /** * The rectangle to fit. * * It should be specified relative to the top left corner if page specified * relative using {@link DestinationPropertiesBase#page} or relative to the bottom left corner * if page specified using {@link DestinationPropertiesBase#pageIndex}. * See {@link Destination} description for details. */ bounds?: Rect; }; /** * Display the page designated by {@link DestinationPropertiesBase#page}, with its contents magnified just enough to fit its bounding box * entirely within the window both horizontally and vertically. * If the required horizontal and vertical magnification factors are different, use the smaller of the two, * centering the bounding box within the window in the other dimension. * @see {@link DestinationFitB} */ export type DestinationFitBProperties = DestinationPropertiesBase & { type: "fitb"; }; /** * Display the page designated by {@link DestinationPropertiesBase#page}, with the vertical coordinate top positioned at the top edge of the window * and the contents of the page magnified just enough to fit the entire width of its bounding box within the window. * A null value for top specifies that the current value of that parameter is to be retained unchanged. * @see {@link DestinationFitBH} */ export type DestinationFitBHProperties = DestinationPropertiesBase & { type: "fitbh"; /** * The top coordinate of the document window, if null then unchanged. * * It should be specified relative to the top left corner if page specified * relative using {@link DestinationPropertiesBase#page} or relative to the bottom left corner * if page specified using {@link DestinationPropertiesBase#pageIndex}. * See {@link Destination} description for details. */ top?: number; }; /** * Display the page designated by {@link DestinationPropertiesBase#page}, with the horizontal coordinate left positioned at the left edge of the window and * the contents of the page magnified just enough to fit the entire height of its bounding box within the window. * A null value for left specifies that the current value of that parameter is to be retained unchanged. * @see {@link DestinationFitBV} */ export type DestinationFitBVProperties = DestinationPropertiesBase & { type: "fitbv"; /** * The left coordinate of the document window, if null then unchanged. */ left?: number; }; /** * Defines destination as reference to another destination, referenced destination * can be in Dests dictionary of PDF document or in Dests subtree of Name Tree. * @see {@link DestinationRef} */ export type DestinationRefProperties = { type: "ref"; /** * The name of referenced destination in the Dests dictionary of PDF document. */ name: string; /** * Indicates whether this {@link DestinationRefProperties} references * destination in Dests dictionary of PDF document or in Dests subtree of document's Name Tree. */ nameTree?: boolean; }; /** * Common type for destinations defining a document position as a position on a page. * @see {@link Destination} */ export type DestinationProperties = DestinationXYZProperties | DestinationFitProperties | DestinationFitHProperties | DestinationFitVProperties | DestinationFitRProperties | DestinationFitBProperties | DestinationFitBHProperties | DestinationFitBVProperties | DestinationRefProperties; /** * Base class for PDF actions which can be performed when user clicks links, document outlines etc. */ export declare abstract class DestinationBase extends DocAction { } /** * The abstract base class for types representing a destination * that defines a particular view of a document. * A destination consists of: * The page of the document to be displayed. * The location of the document window on that page. * The magnification (zoom factor) to use when displaying the page. * Important note about vertical coordinates: * In PDFs, all coordinates are specified relative to the bottom left corner, * with the Y axis going up. * DsPdfJS uses the more common coordinate system with the origin * in the top left corner, with the Y axis going down. * In most situations the Y coordinates are automatically converted by DsPdfJS. * In classes derived from {@link Destination} this is also done if * the destination's target page is specified as the {@link PdfPage} * object. * But if the destination's target page is specified by index, * automatic conversion of the Y coordinate cannot be done, and it should be * specified relative to the bottom left corner as per the PDF spec. * When the Y coordinate is specified relative to the page bottom, * it is noted in the parameter's description. * (It is recommended that constructors accepting a {@link PdfPage} object * are used instead.) * * All properties defining the Y coordinate has linked property with "Pdf" prefix, * for example Y and PdfY, the property with "Pdf" prefix contains a value relative to the * bottom left corner with the Y axis going up. */ export declare abstract class Destination extends DestinationBase { /** * Gets the index of this destination's target page. * Returns null if the target page was specified as a {@link PdfPage} object. * Note that if this property is not null, then any Y coordinate is * relative to the bottom left corner (see {@link Destination} description for details). */ get pageIndex(): number | null; /** * Gets this destination's target {@link PdfPage} object. * Returns null if the target page was specified by index. */ get page(): PdfPage | null; } /** * Display the page designated by {@link Destination#page}, with the coordinates (left, top) positioned at the upper-left corner * of the window and the contents of the page magnified by the factor zoom. * A null value for any of the parameters left, top, or zoom specifies that the current value * of that parameter is to be retained unchanged. A zoom value of 0 has the same meaning as a null value. */ export declare class DestinationXYZ extends Destination { /** * Initializes a new instance of the {@link DestinationXYZ} class. * * Note that all Y coordinates should be specified relative to the bottom of the page. * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationXYZ}. * @param pageIndex - The target page index. * @param left - The left coordinate of the document window. * @param pdfTop - The top coordinate of the document window relative to the bottom of the page. * @param zoom - The zoom factor of the document window. */ constructor(om: ObjectManager, pageIndex: number, left?: number, pdfTop?: number, zoom?: number); /** * Initializes a new instance of the {@link DestinationXYZ} class. * * Note that all Y coordinates should be specified relative to the bottom of the page. * @param pageIndex - The target page index. * @param left - The left coordinate of the document window. * @param pdfTop - The top coordinate of the document window relative to the bottom of the page. * @param zoom - The zoom factor of the document window. */ constructor(pageIndex: number, left?: number, pdfTop?: number, zoom?: number); /** * Initializes a new instance of the {@link DestinationXYZ} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationXYZ}. * @param page - The target {@link PdfPage}. * @param left - The left coordinate of the document window. * @param top - The top coordinate of the document window relative to the top of the page. * @param zoom - The zoom factor of the document window. */ constructor(om: ObjectManager, page: PdfPage, left?: number, top?: number, zoom?: number); /** * Initializes a new instance of the {@link DestinationXYZ} class. * * @param page - The target {@link PdfPage}. * @param left - The left coordinate of the document window. * @param top - The top coordinate of the document window relative to the top of the page. * @param zoom - The zoom factor of the document window. */ constructor(page: PdfPage, left?: number, top?: number, zoom?: number); /** * Gets the left coordinate of the document window, if null then unchanged. */ get left(): number | null; /** * Gets the top coordinate of the document window, if null then unchanged. * * If the target page of this destination was specified as an index ({@link Destination#pageIndex}), * then this property returns the Y coordinate relative to the page bottom. * If the target page was specified as a page object (see {@link Destination#page}), * then this property returns the Y coordinate relative to the page top. * See {@link Destination} description for details. */ get top(): number | null; /** * Gets the top coordinate of the document window relative to the bottom left corner, * unchanged if null. */ get pdfTop(): number | null; /** * Gets the zoom factor of the document window, unchanged if null or zero. */ get zoom(): number | null; } /** * Display the page designated by {@link Destination#page}, with its contents magnified just enough to fit the entire page * within the window both horizontally and vertically. * If the required horizontal and vertical magnification factors are different, use the smaller of the two, * centering the page within the window in the other dimension. */ export declare class DestinationFit extends Destination { /** * Initializes a new instance of the {@link DestinationFit} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFit}. * @param pageIndex - The target page index. */ constructor(om: ObjectManager, pageIndex: number); /** * Initializes a new instance of the {@link DestinationFit} class. * * @param pageIndex - The target page index. */ constructor(pageIndex: number); /** * Initializes a new instance of the {@link DestinationFit} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFit}. * @param page - The target {@link PdfPage}. */ constructor(om: ObjectManager, page: PdfPage); /** * Initializes a new instance of the {@link DestinationFit} class. * * @param page - The target {@link PdfPage}. */ constructor(page: PdfPage); } /** * Display the page designated by {@link Destination#page}, with the vertical coordinate top positioned at the top edge of the window * and the contents of the page magnified just enough to fit the entire width of the page within the window. * A null value for top specifies that the current value of that parameter is to be retained unchanged. */ export declare class DestinationFitH extends Destination { /** * Initializes a new instance of the {@link DestinationFitH} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitH}. * @param pageIndex - The target page index. * @param pdfTop - The top coordinate of the document window relative to the bottom of the page. */ constructor(om: ObjectManager, pageIndex: number, pdfTop?: number); /** * Initializes a new instance of the {@link DestinationFitH} class. * * @param pageIndex - The target page index. * @param pdfTop - The top coordinate of the document window relative to the bottom of the page. */ constructor(pageIndex: number, pdfTop?: number); /** * Initializes a new instance of the {@link DestinationFitH} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitH}. * @param page - The target {@link PdfPage}. * @param top - The top coordinate of the document window relative to the top of the page. */ constructor(om: ObjectManager, page: PdfPage, top?: number); /** * Initializes a new instance of the {@link DestinationFitH} class. * * @param page - The target {@link PdfPage}. * @param top - The top coordinate of the document window relative to the top of the page. */ constructor(page: PdfPage, top?: number); /** * Gets the top coordinate of the document window, if null then unchanged. * * If the target page of this destination was specified as an index ({@link Destination#pageIndex}), * then this property returns the Y coordinate relative to the page bottom. * If the target page was specified as a page object (see {@link Destination#page}), * then this property returns the Y coordinate relative to the page top. * See {@link Destination} description for details. */ get top(): number | null; /** * Gets the top coordinate of the document window relative to the bottom left corner, * unchanged if null. */ get pdfTop(): number | null; } /** * Display the page designated by {@link Destination#page}, with the horizontal coordinate left positioned at the left edge of the window * and the contents of the page magnified just enough to fit the entire height of the page within the window. * A null value for left specifies that the current value of that parameter is to be retained unchanged. */ export declare class DestinationFitV extends Destination { static innerCreate(om: ObjectManager, id: number): DestinationFitV; /** * Initializes a new instance of the {@link DestinationFitV} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitV}. * @param pageIndex - The target page index. * @param left - The left coordinate of the document window. */ constructor(om: ObjectManager, pageIndex: number, left?: number); /** * Initializes a new instance of the {@link DestinationFitV} class. * * @param pageIndex - The target page index. * @param left - The left coordinate of the document window. */ constructor(pageIndex: number, left?: number); /** * Initializes a new instance of the {@link DestinationFitV} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitV}. * @param page - The target {@link PdfPage}. * @param left - The left coordinate of the document window. */ constructor(om: ObjectManager, page: PdfPage, left?: number); /** * Initializes a new instance of the {@link DestinationFitV} class. * * @param page - The target {@link PdfPage}. * @param left - The left coordinate of the document window. */ constructor(page: PdfPage, left?: number); /** * Gets the left coordinate of the document window, if null then unchanged. */ get left(): number | null; } /** * Display the page designated by {@link Destination#page}, with its contents magnified just enough to fit the rectangle * specified by the coordinates left, bottom, right, and top entirely within the window both horizontally and vertically. * If the required horizontal and vertical magnification factors are different, use the smaller of the two, * centering the rectangle within the window in the other dimension. */ export declare class DestinationFitR extends Destination { /** * Initializes a new instance of the {@link DestinationFitR} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitR}. * @param pageIndex - The target page index. * @param bounds - The rectangle to fit relative to the bottom left corner. */ constructor(om: ObjectManager, pageIndex: number, bounds: Rect); /** * Initializes a new instance of the {@link DestinationFitR} class. * * @param pageIndex - The target page index. * @param bounds - The rectangle to fit relative to the bottom left corner. */ constructor(pageIndex: number, bounds: Rect); /** * Initializes a new instance of the {@link DestinationFitR} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitR}. * @param page - The target {@link PdfPage}. * @param bounds - The rectangle to fit relative to the top left corner. */ constructor(om: ObjectManager, page: PdfPage, bounds: Rect); /** * Initializes a new instance of the {@link DestinationFitR} class. * * @param page - The target {@link PdfPage}. * @param bounds - The rectangle to fit relative to the top left corner. */ constructor(page: PdfPage, bounds: Rect); /** * Gets the rectangle to fit. * * If the target page of this destination was specified as an index (see {@link Destination#pageIndex}), * then this property returns a rectangle relative to the bottom left corner. * If the target page was specified as a page object (see {@link Destination#page}), * then this property returns a rectangle relative to the top left corner. * See {@link Destination} description for details. */ get bounds(): Rect | null; /** * Gets the rectangle to fit relative to the bottom left corner. */ get pdfBounds(): Rect | null; } /** * Display the page designated by {@link Destination#page}, with its contents magnified just enough to fit its bounding box * entirely within the window both horizontally and vertically. * If the required horizontal and vertical magnification factors are different, use the smaller of the two, * centering the bounding box within the window in the other dimension. */ export declare class DestinationFitB extends Destination { /** * Initializes a new instance of the {@link DestinationFitB} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitB}. * @param pageIndex - The target page index. */ constructor(om: ObjectManager, pageIndex: number); /** * Initializes a new instance of the {@link DestinationFitB} class. * * @param pageIndex - The target page index. */ constructor(pageIndex: number); /** * Initializes a new instance of the {@link DestinationFitB} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitB}. * @param page - The target {@link PdfPage}. */ constructor(om: ObjectManager, page: PdfPage); /** * Initializes a new instance of the {@link DestinationFitB} class. * * @param page - The target {@link PdfPage}. */ constructor(page: PdfPage); } /** * Display the page designated by {@link Destination#page}, with the vertical coordinate top positioned at the top edge of the window * and the contents of the page magnified just enough to fit the entire width of its bounding box within the window. * A null value for top specifies that the current value of that parameter is to be retained unchanged. */ export declare class DestinationFitBH extends Destination { /** * Initializes a new instance of the {@link DestinationFitBH} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitBH}. * @param pageIndex - The target page index. * @param pdfTop - The top coordinate of the document window relative to the bottom of the page. */ constructor(om: ObjectManager, pageIndex: number, pdfTop?: number); /** * Initializes a new instance of the {@link DestinationFitBH} class. * * @param pageIndex - The target page index. * @param pdfTop - The top coordinate of the document window relative to the bottom of the page. */ constructor(pageIndex: number, pdfTop?: number); /** * Initializes a new instance of the {@link DestinationFitBH} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitBH}. * @param page - The target {@link PdfPage}. * @param top - The top coordinate of the document window relative to the top of the page. */ constructor(om: ObjectManager, page: PdfPage, top?: number); /** * Initializes a new instance of the {@link DestinationFitBH} class. * * @param page - The target {@link PdfPage}. * @param top - The top coordinate of the document window relative to the top of the page. */ constructor(page: PdfPage, top?: number); /** * Gets the top coordinate of the document window, if null then unchanged. * * If the target page of this destination was specified as an index ({@link Destination#pageIndex}), * then this property returns the Y coordinate relative to the page bottom. * If the target page was specified as a page object (see {@link Destination#page}), * then this property returns the Y coordinate relative to the page top. * See {@link Destination} description for details. */ get top(): number | null; /** * Gets the top coordinate of the document window relative to the bottom left corner, * unchanged if null. */ get pdfTop(): number | null; } /** * Display the page designated by {@link Destination#page}, with the horizontal coordinate left positioned at the left edge of the window and * the contents of the page magnified just enough to fit the entire height of its bounding box within the window. * A null value for left specifies that the current value of that parameter is to be retained unchanged. */ export declare class DestinationFitBV extends Destination { /** * Initializes a new instance of the {@link DestinationFitBV} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitBV}. * @param pageIndex - The target page index or {@link PdfPage}. * @param left - The left coordinate of the document window. */ constructor(om: ObjectManager, pageIndex: number, left?: number); /** * Initializes a new instance of the {@link DestinationFitBV} class. * * @param pageIndex - The target page index or {@link PdfPage}. * @param left - The left coordinate of the document window. */ constructor(pageIndex: number, left?: number); /** * Initializes a new instance of the {@link DestinationFitBV} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationFitBV}. * @param page - The target page index or {@link PdfPage}. * @param left - The left coordinate of the document window. */ constructor(om: ObjectManager, page: PdfPage, left?: number); /** * Initializes a new instance of the {@link DestinationFitBV} class. * * @param page - The target page index or {@link PdfPage}. * @param left - The left coordinate of the document window. */ constructor(page: PdfPage, left?: number); /** * Gets the left coordinate of the document window, if null then unchanged. */ get left(): number | null; } /** * Represents a destination object in a format that is unsupported by DsPdfJS. */ export declare class DestinationUnknown extends Destination { } /** * Defines destination as reference to another destination, referenced destination * can be in Dests dictionary of PDF document or in Dests subtree of Name Tree. */ export declare class DestinationRef extends DestinationBase { /** * Initializes a new instance of the {@link DestinationRef} class. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link DestinationRef}. * @param name - The name of referenced destination. * @param nameTree - Specifies where referenced destination is in Dests dictionary of document or in Dests subtree of Name Tree. */ constructor(om: ObjectManager, name: string, nameTree?: boolean); /** * Initializes a new instance of the {@link DestinationRef} class. * * @param name - The name of referenced destination. * @param nameTree - Specifies where referenced destination is in Dests dictionary of document or in Dests subtree of Name Tree. */ constructor(name: string, nameTree?: boolean); /** * Gets the name of referenced destination in the Dests dictionary of PDF document. */ get name(): string; /** * Gets a value indicating whether this {@link DestinationRef} references * destination in Dests dictionary of PDF document or in Dests subtree of document's Name Tree. */ get nameTree(): boolean | null; }