FoxitPDFSDKforWeb v10.0.0
Foxit PDF SDK for Web
HeaderFooter Class Reference

PDF HeaderFooter object. More...

Public Member Functions

 constructor (json)
 Constructor of HeaderFooter. More...
 
 enableFixedSizedForPrint (enable)
 Enable fixed size for print of header or footer or not. More...
 
 enableTextShrinked (enable)
 Enable text shrinked of header or footer or not. More...
 
 getContent (position)
 Get content formats. More...
 
 getUnderline ()
 Get underline text decoration. More...
 
 isEmpty ()
 Check whether HeaderFooter is empty. More...
 
 setContentFormat (position, format)
 Set content formats. More...
 
 setFont (fontId)
 Set font. More...
 
 setMargin (rect)
 Set margin. More...
 
 setRange (range)
 Set the page range to which the header or footer will be inserted. More...
 
 setStartDisplayingPage (index)
 Set first page index to be displayed in first page of range. More...
 
 setTextColor (color)
 Set text color of header or footer. More...
 
 setTextSize (size)
 Set text size of header or footer. More...
 
 setUnderline (underline)
 Set underline text decoration or not. More...
 

Detailed Description

PDF HeaderFooter object.

Since
7.2.0

Member Function Documentation

◆ constructor()

HeaderFooter::constructor (   json)
inline

Constructor of HeaderFooter.

Note
It's recommanded to use method to config header and footer.
Parameters
[json]object - A json object specify configuration of header footer. For example:
{
contentFormats: {TopLeft: [{type:'string',value:'***'}]},
margin: {left: 72, right: 36, top: 72, bottom: 36},
textSize: 12,
textColor: 4278190080,
hasTextShrinked: false,
hasFixedSized: false,
startPageNumber: 1,
underline:false
}

◆ enableFixedSizedForPrint()

HeaderFooter::enableFixedSizedForPrint (   enable)
inline

Enable fixed size for print of header or footer or not.

Parameters
enableboolean - Specifies fixed size for print or not.

◆ enableTextShrinked()

HeaderFooter::enableTextShrinked (   enable)
inline

Enable text shrinked of header or footer or not.

Parameters
enableboolean - Specifies text shrinked or not.

◆ getContent()

HeaderFooter::getContent (   position)
inline

Get content formats.

Parameters
positionstring - Location of header or footer. Please refer to Position. Position Position::centerLeft, Position::center and Position::centerRight are not available.

◆ getUnderline()

HeaderFooter::getUnderline ( )
inline

Get underline text decoration.

Returns
boolean - True for underline, false for normal style.
Since
7.5.0

◆ isEmpty()

HeaderFooter::isEmpty ( )
inline

Check whether HeaderFooter is empty.

Note
If a HeaderFooter is empty, nothing will happend to call PDFDoc.addHeaderFooter.
Returns
boolean - Whether HeaderFooter is empty.
Since
7.3.0

◆ setContentFormat()

HeaderFooter::setContentFormat (   position,
  format 
)
inline

Set content formats.

Parameters
positionstring - Location of header or footer. Please refer to Position. Position Position::centerLeft, Position::center and Position::centerRight are not available.
formatArray<{type:string,value:any}> - A json array which specifies contents' format. Please refer to date_Format and page_Number_Format for date and page number format's detail.

For Example:

[
{
type:"string",// Type string should be one of "string", "pageNumber" and "date"
value:"abc"
},
{
type:"date",// Type string should be one of "string", "pageNumber" and "date",
value:0, // Date format.
},
{
type:"pageNumber",// Type string should be one of "string", "pageNumber" and "date"
value:0,//Page Number's format type.
}
]

◆ setFont()

HeaderFooter::setFont (   fontId)
inline

Set font.

Parameters
fontIdnumber - An integer which specifies font. Please refer to Standard_Font.

◆ setMargin()

HeaderFooter::setMargin (   rect)
inline

Set margin.

Parameters
rectPDFRect - A rectangle specifies header or footer's margin.
Note
This value does not represents a rectangle. It just defines the left margin, bottom margin, right margin and top margin of a PDF page. These margins can be used to locate header-footer content in different places:
  • Left margin is used to specify the location for left header or footer content to be started.
  • right margin is used to specify the location for right header or footer content to be ended.
  • bottom margin is used to specify the top location for any footer content to be placed.
  • top margin is used to specify the bottom location for any header content to be placed.
if bottom margin and top margin is less than or equal to 0, the header or footer content will be invisible. so the default construction has a default value RectF(72.0, 36.0, 72.0, 36.0);

◆ setRange()

HeaderFooter::setRange (   range)
inline

Set the page range to which the header or footer will be inserted.

Parameters
rangePageRange - Please refer to PageRange.

◆ setStartDisplayingPage()

HeaderFooter::setStartDisplayingPage (   index)
inline

Set first page index to be displayed in first page of range.

Parameters
indexnumber - Page Index.

◆ setTextColor()

HeaderFooter::setTextColor (   color)
inline

Set text color of header or footer.

Parameters
colornumber - Text color(0xffRRGGBB). Alpha chennal is ignored, and always is 0xff.

◆ setTextSize()

HeaderFooter::setTextSize (   size)
inline

Set text size of header or footer.

Parameters
sizenumber - Text size.

◆ setUnderline()

HeaderFooter::setUnderline (   underline)
inline

Set underline text decoration or not.

Parameters
underlineboolean - True for underline, false for normal style.
Since
7.5.0

Foxit Software Corporation Logo
@2024 Foxit Software Incorporated. All rights reserved.