InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IPDFHyperlinks Class Referenceabstract

#include <IPDFHyperlinks.h>

Inheritance diagram for IPDFHyperlinks:
IPMUnknown

Classes

class  PageDestination
 

Public Types

enum  { kDefaultIID = IID_IPDFHYPERLINKS }
 
enum  DestinationType {
  DestXYZ = 0, DestFit, DestFitH, DestFitV,
  DestFitR, DestFitB, DestFitBH, DestFitBV
}
 
enum  NamedType { NextPage = 0, PrevPage, FirstPage, LastPage }
 

Public Member Functions

virtual ErrorCode BeginBook (PDDoc thePDDoc, bool32 addHyperlinks, IDataBase *db, bool32 addBookmarks, bool32 bookExport, DocPageIndexList docIndexList, bool16 readerSpreads, bool16 layers=false)=0
 
virtual ErrorCode EndBook ()=0
 
virtual ErrorCode BeginDocument (IDataBase *db)=0
 
virtual ErrorCode EndDocument ()=0
 
virtual ErrorCode BeginPage (PDPage thePDPage, PMRect &pageBounds, PMMatrix &pageBoundsToSpreadMatrix, UID pageUID)=0
 
virtual ErrorCode EndPage ()=0
 
virtual ErrorCode HyperlinkHotSpot (const PMRect &hotSpot, const PMString &name, const HotSpotAttributes *pAttributes=nil, int32 *pAnnotation=nil)=0
 
virtual ErrorCode HyperlinkHotSpotPage (const PMRect &hotSpot, int32 pageIndex, const HotSpotAttributes *pAttributes=nil, int32 *pAnnotation=nil)=0
 
virtual ErrorCode HyperlinkHotSpotURL (const PMRect &hotSpot, const PMString &theURL, const bool32 isMap, const HotSpotAttributes *pAttributes=nil, int32 *pAnnotation=nil)=0
 
virtual ErrorCode HyperlinkHotSpotNamed (const PMRect &hotSpot, NamedType namedType, const HotSpotAttributes *pAttributes=nil, int32 *pAnnotation=nil)=0
 
virtual ErrorCode HyperlinkHotSpotExternal (const PMRect &hotSpot, const PMString &name, const PMString &fullpath, bool32 bNewWindow=false, const HotSpotAttributes *pAttributes=nil, int32 *pAnnotation=nil)=0
 
virtual ErrorCode HyperlinkDestination (const PMString &name, DestinationType destType, const PMRect *destRect=nil, const PMReal *zoomFactor=nil)=0
 
virtual ErrorCode GetLinkAnnotation (int32 annotation, CosObj *page, PDAnnot *annot)=0
 
virtual ErrorCode CreateHyperlink (IDataBase *db, UID hyperlinkUID, PMRect &hotSpot, int32 *linkAnnotation)=0
 
virtual ErrorCode HyperlinkHotSpotExternalPage (const PMRect &hotSpot, const PageDestination &pageDestination, const PMString &fullpath, bool32 bNewWindow=false, const HotSpotAttributes *pAttributes=nil, int32 *pAnnotation=nil)=0
 
virtual ErrorCode BeginLayer (CosObj layerInfo)=0
 
virtual ErrorCode EndLayer ()=0
 
virtual ErrorCode CreateEndnoteRefLink (IDataBase *db, UID endnoteUID, PMRect &hotSpot, int32 *linkAnnotation)=0
 
virtual ErrorCode CreateEndnoteRangeLink (IDataBase *db, UID endnoteRangeUID, PMRect &hotSpot, int32 *linkAnnotation)=0
 
virtual ErrorCode GetEndnotelinkAnnotation (int32 annotation, CosObj *page, PDAnnot *annot)=0
 
virtual ErrorCode GetHyperlinkAltText (int32 annotation, PMString &altText)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

IPDFHyperlinks contains methods for creating PDF hyperlinks when exporting PDFs.

As a document is being exported to a PDF file, this interface is called to signal special events and these methods come in pairs, see BeginBook, EndBook, BeginDocument, EndDocument etc. The export process draws to a PDF port, similar to drawing to the screen or to a printer port. When it is on a page, between calls BeginPage, EndPage, you can call methods to create hyperlinks on the current page. See Hyperlink... methods.

You can get this interface from a IGraphicsPort (gPort) using this: InterfacePtr<IPDFHyperlinks> structureMarks(gPort, IID_IPDFHYPERLINKS);

Member Enumeration Documentation

Destination type.
Enumerator
DestXYZ 

Destination specified as upper-left corner point and a zoom factor.

DestFit 

Fits the page into the window, corresponding to the Acrobat viewer’s FitPage menu item.

DestFitH 

Fits the widths of the page into the window, corresponding to the Acrobat viewer’s Fit Width menu item.

DestFitV 

Fits the height of the page into a window.

DestFitR 

Fits the rectangle specified by its upper-left and lower-right corner points into the window.

DestFitB 

Fits the rectangle containing all visible elements on the page (known as the bounding box) into the window, corresponds to the Acrobat viewer’s Fit Visible menu item.

DestFitBH 

Fits the width of the bounding box into the window.

DestFitBV 

Fits the height of the bounding box into the window.

Special named destinations.
Enumerator
NextPage 

Go to the next page.

PrevPage 

Go to the previous page.

FirstPage 

Go to the first page of the document.

LastPage 

Go to the last page of the document.

Member Function Documentation

virtual ErrorCode IPDFHyperlinks::BeginBook (PDDoc thePDDoc,
bool32 addHyperlinks,
IDataBasedb,
bool32 addBookmarks,
bool32 bookExport,
DocPageIndexList docIndexList,
bool16 readerSpreads,
bool16 layers = false 
)
pure virtual
This is called by the default implementation when starting a PDF export whether it is a book export

or a normal export.

Parameters
thePDDocis the PDDoc being created.
addHyperlinksis true when the PDF export preference specifies hyperlinks.
dbis the database of the document being exported.
addBookmarksis true when the PDF export preference specifies bookmarks.
bookExportis true when exporting a book.
docIndexListis the document page index list.
readerSpreadsis true when reader spreads are on.
layersis true when exporting layers.
Returns
kSuccess when successful.
virtual ErrorCode IPDFHyperlinks::BeginDocument (IDataBasedb)
pure virtual
This is called by the default implementation when starting to export a document. A book has one or

more documents.

Parameters
dbis the database of the document being exported.
virtual ErrorCode IPDFHyperlinks::BeginLayer (CosObj layerInfo)
pure virtual
This is called by the default implementation when starting to export a layer of a document. 

Parameters
layerInfois the layer information.
virtual ErrorCode IPDFHyperlinks::BeginPage (PDPage thePDPage,
PMRectpageBounds,
PMMatrixpageBoundsToSpreadMatrix,
UID pageUID 
)
pure virtual
This is called by the default implementation when starting to export a page of a document. 

Parameters
thePDPageis the PDPage being created.
pageBoundsis the page bounds.
pageUIDis the InDesign page UID being exported.
virtual ErrorCode IPDFHyperlinks::CreateEndnoteRangeLink (IDataBasedb,
UID endnoteRangeUID,
PMRecthotSpot,
int32 * linkAnnotation 
)
pure virtual
Create a endnote link at endnote range on the current page with the given hot spot. The attributes and destination are

determined by the db, endnoteRangeUID.

Parameters
dbof endnoteRangeUID.
endnoteRangeUIDis the UID of the endnote range.
hotSpotis the location of the hotspot rectangle on the page.
linkAnnotationpoints to an optional return parameter. The int32 returned is a token used with
virtual ErrorCode IPDFHyperlinks::CreateEndnoteRefLink (IDataBasedb,
UID endnoteUID,
PMRecthotSpot,
int32 * linkAnnotation 
)
pure virtual
Create a link at endnote reference on the current page with the given hot spot. The attributes and destination are

determined by the db, endnoteUID.

Parameters
dbof endnoteUID.
endnoteUIDis the UID of the endnote reference.
hotSpotis the location of the hotspot rectangle on the page.
linkAnnotationpoints to an optional return parameter. The int32 returned is a token used with
virtual ErrorCode IPDFHyperlinks::CreateHyperlink (IDataBasedb,
UID hyperlinkUID,
PMRecthotSpot,
int32 * linkAnnotation 
)
pure virtual
Create a hyperlink on the current page with the given hot spot. The attributes and destination are

determined by the db, hyperlinkUID.

Parameters
dbof hyperlinkUID.
hyperlinkUIDis the hyperlinkUID.
hotSpotis the location of the hotspot rectangle on the page.
linkAnnotationpoints to an optional return parameter. The int32 returned is a token used with GetLinkAnnotation to get the associated PDF link annotation.
virtual ErrorCode IPDFHyperlinks::EndBook ()
pure virtual
This is called by the default implementation when ending a PDF export whether it is a book export

or a normal export.

virtual ErrorCode IPDFHyperlinks::EndDocument ()
pure virtual

This is called by the default implementation when ending a document.

virtual ErrorCode IPDFHyperlinks::EndLayer ()
pure virtual

This is called by the default implementation when ending a layer of a document.

virtual ErrorCode IPDFHyperlinks::EndPage ()
pure virtual

This is called by the default implementation when ending a page of a document.

virtual ErrorCode IPDFHyperlinks::GetEndnotelinkAnnotation (int32 annotation,
CosObj * page,
PDAnnot * annot 
)
pure virtual
Get the CosObj page and PDAnnot for the given endnote annotation. The annotation is valid between

BeginDocument and EndDocument.

Parameters
annotationspecifies the PDF endnote annotation to get. It comes from a previous call to one of the creation methods above.
pageis the page the hyperlink is on.
annotis the PDF annotation.
virtual ErrorCode IPDFHyperlinks::GetHyperlinkAltText (int32 annotation,
PMStringaltText 
)
pure virtual
Get alternate text of hyperlink.

Parameters
annotationspecifies hyperlink annotation.
altTextstores alt text of hyperlink.
Returns
kSuccess when successful.
virtual ErrorCode IPDFHyperlinks::GetLinkAnnotation (int32 annotation,
CosObj * page,
PDAnnot * annot 
)
pure virtual
Get the CosObj page and PDAnnot for the given annotation. The annotation is valid between 

BeginDocument and EndDocument.

Parameters
annotationspecifies the PDF annotation to get. It comes from a previous call to one of the creation methods above.
pageis the page the hyperlink is on.
annotis the PDF annotation.
virtual ErrorCode IPDFHyperlinks::HyperlinkDestination (const PMStringname,
DestinationType destType,
const PMRectdestRect = nil,
const PMRealzoomFactor = nil 
)
pure virtual
Create a hyperlink named destination on the current page at the given location with the given name.

Parameters
nameis the destination name to create. This name is matched up with the name specified by HyperlinkHotSpot.
destTypeis the type of destination to create.
destRectis an optional pointer to a reference rectangle. See DestinationType.
zoomFactoris an optional pointer to a zoom factor. See DestinationType.
virtual ErrorCode IPDFHyperlinks::HyperlinkHotSpot (const PMRecthotSpot,
const PMStringname,
const HotSpotAttributespAttributes = nil,
int32 * pAnnotation = nil 
)
pure virtual

Create a hyperlink on the current page that goes to a named destination.

Parameters
hotSpotis the location of the hotspot rectangle on the page.
nameis the destination name. This is matched by name with the destination created with HyperlinkDestination.
pAttributespoints to the optional hotspot attributes. When nil, the default attributes are used.
pAnnotationpoints to an optional return parameter. The int32 returned is a token used with GetLinkAnnotation to get the associated PDF link annotation.
Returns
kSuccess when successful.
virtual ErrorCode IPDFHyperlinks::HyperlinkHotSpotExternal (const PMRecthotSpot,
const PMStringname,
const PMStringfullpath,
bool32 bNewWindow = false,
const HotSpotAttributespAttributes = nil,
int32 * pAnnotation = nil 
)
pure virtual
Create a hyperlink on the current page which goes to another PDF document.

Parameters
hotSpotis the location of the hotspot rectangle on the page.
nameis the named destination in another PDF document.
fullpathis the full path name to the PDF document.
bNewWindowis optional. Pass true to open the new document in a new window.
pAttributespoints to the optional hotspot attributes. When nil, the default attributes are used.
pAnnotationpoints to an optional return parameter. The int32 returned is a token used with GetLinkAnnotation to get the associated PDF link annotation.
Returns
kSuccess when successful.
virtual ErrorCode IPDFHyperlinks::HyperlinkHotSpotExternalPage (const PMRecthotSpot,
const PageDestinationpageDestination,
const PMStringfullpath,
bool32 bNewWindow = false,
const HotSpotAttributespAttributes = nil,
int32 * pAnnotation = nil 
)
pure virtual
Create a hyperlink on the current page which goes to another PDF document. 

Parameters
hotSpotis the location of the hotspot rectangle on the page.
pageDestinationcontains the page index along with destination parameters and specifies where it goes in the other document.
fullpathis the full path name to the PDF document.
bNewWindowis optional. Pass true to open the new document in a new window.
pAttributespoints to the optional hotspot attributes. When nil, the default attributes are used.
pAnnotationpoints to an optional return parameter. The int32 returned is a token used with GetLinkAnnotation to get the associated PDF link annotation.
Returns
kSuccess when successful.
virtual ErrorCode IPDFHyperlinks::HyperlinkHotSpotNamed (const PMRecthotSpot,
NamedType namedType,
const HotSpotAttributespAttributes = nil,
int32 * pAnnotation = nil 
)
pure virtual
Create a hyperlink on the current page which goes to the NamedType.

Parameters
hotSpotis the location of the hotspot rectangle on the page.
namedTypeis the destination, either first, last, next or prev page, see NamedType.
pAttributespoints to the optional hotspot attributes. When nil, the default attributes are used.
pAnnotationpoints to an optional return parameter. The int32 returned is a token used with GetLinkAnnotation to get the associated PDF link annotation.
Returns
kSuccess when successful.
virtual ErrorCode IPDFHyperlinks::HyperlinkHotSpotPage (const PMRecthotSpot,
int32 pageIndex,
const HotSpotAttributespAttributes = nil,
int32 * pAnnotation = nil 
)
pure virtual
Create a hyperlink on the current page which goes to the given page.

Parameters
hotSpotis the location of the hotspot rectangle on the page.
pageIndexis the destination page of the hyperlink.
pAttributespoints to the optional hotspot attributes. When nil, the default attributes are used.
pAnnotationpoints to an optional return parameter. The int32 returned is a token used with GetLinkAnnotation to get the associated PDF link annotation.
Returns
kSuccess when successful.
virtual ErrorCode IPDFHyperlinks::HyperlinkHotSpotURL (const PMRecthotSpot,
const PMStringtheURL,
const bool32 isMap,
const HotSpotAttributespAttributes = nil,
int32 * pAnnotation = nil 
)
pure virtual
Create a hyperlink on the current page which goes to the given URL.

Parameters
hotSpotis the location of the hotspot rectangle on the page.
theURLis the destination URL of the hyperlink.
isMapis true to track the mouse position when the URI is resolved.
pAttributespoints to the optional hotspot attributes. When nil, the default attributes are used.
pAnnotationpoints to an optional return parameter. The int32 returned is a token used with GetLinkAnnotation to get the associated PDF link annotation.
Returns
kSuccess when successful.