Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents the PDF document object.

This class offers functions to retrieve different part of a PDF document.
This class also offers functions for modifying or getting information from a PDF document, and so on.

To get the active doc, please use:

Foxit.ReaderApp.getActiveDoc();

Hierarchy

  • Doc

Index

Methods

addAnnot

  • Add an annotation into a specified page.

    see

    Doc

    Parameters

    • pageIndex: number

      Specifies target page.

    • annotJson: AnnotOptions

      Annotation's json object.

    Returns Promise<undefined | Annot[]>

    window.addAnnot = async () => {
      let result = [];
      let tmp= '';
      let tests = [
        {
          annotJson:{
            type:'caret', title:"title", subject:"caret", contents:'contents', name:'name', intent:"testintent",
            opacity:0.75, color:0xff0000, flags:0, rect:{left:50,right:100,top:800,bottom:750},
            borderInfo:{
              width:4, style:0, cloudIntensity:1, dashPhase:1, dashes:[2,7],
            },
          },
          object:"caret",
        },
        {
          annotJson:{
            type:'highlight', title:"title", subject:"highlight", contents:'contents', name:'name',
            opacity:0.75, color:0xff0000, flags:0, rect:{left:150,right:200,top:800,bottom:750},
          },
          object:"highlight",
        },
        {
          annotJson:{
            type:'squiggly', title:"title", subject:"squiggly", contents:'contents', name:'name',
            opacity:0.75, color:0xff0000, flags:0, rect:{left:250,right:300,top:800,bottom:750},
          },
          object:"squiggly",
        },
        {
          annotJson:{
            type:'strikeout', title:"title", subject:"strikeout", contents:'contents', name:'name',
            opacity:0.75, color:0xff0000, flags:0, rect:{left:350,right:400,top:800,bottom:750},
          },
          object:"strikeout",
        },
        {
          annotJson:{
            type:'underline', title:"title", subject:"underline", contents:'contents', name:'name',
            opacity:0.75, color:0xff0000, flags:0, rect:{left:450,right:500,top:800,bottom:750},
          },
          object:"underline",
        },
        {
          annotJson:{
            type:'freetext', title:"title", subject:"Textbox", contents:'Textbox', name:'Textbox', alignment:0,
            opacity:0.75, color:0x0000ff, fillColor:0x00ffff, flags:0,
            rect:{left:50,right:100,top:700,bottom:650},
            borderInfo:{
              width:4, style:0, cloudIntensity:1, dashPhase:1, dashes:[2,7],
            },
            defaultAppearance:{
              textColor:0xfff0f0,
              textSize:10,
            }
          },
          object:"freetext-Textbox",
        },
        {
          annotJson:{
            intent:"testintent", type:'freetext', title:"title", subject:"Typewriter", contents:'contents', name:'Typewriter',
            opacity:0.75, color:0x00ffff, fillColor:0x00ffff, flags:0, rotation:90,
            rect:{left:150,right:200,top:700,bottom:650}, alignment:1, intent:'FreeTextTypewriter',
            borderInfo:{
              width:4, style:0, cloudIntensity:1, dashPhase:1, dashes:[2,7],
            },
            defaultAppearance:{
              textColor:0x0ff0f0,
              textSize:10,
            }
          },
          object:"freetext-Typewriter",
        },
        {
          annotJson:{
            intent:'FreeTextCallout', type:'freetext', title:"title", subject:"Callout", name:'Callout',
            opacity:0.75, color:0xff00ff, fillColor:0x00ffff, flags:0, calloutLineEndingStyle:4,
            rect:{left:275,right:300,top:675,bottom:650}, contents:'FreeTextCallout',
            calloutLinePoints:[{x:250,y:700},{x:260,y:685},{x:275,y:675}], rotation:180, alignment:2,
            borderInfo:{
              width:4, style:0, cloudIntensity:1, dashPhase:1, dashes:[2,7],
            },
            defaultAppearance:{
              textColor:0x00f0f0,
              textSize:8,
            }
          },
          object:"freetext-Callout",
        },
        {
          annotJson:{
            type:'line', title:"title", subject:"line", contents:'contents', name:'name', styleFillColor:0x00ffff,
            opacity:1, color:0xffff00, flags:4, rect:{left:350,right:400,top:700,bottom:650},
            startPoint:{x:350,y:700}, endPoint:{x:400,y:650}, startStyle:1, endStyle:2, intent:"LineArrow",
            borderInfo:{
              width:4, style:0, cloudIntensity:1, dashPhase:1, dashes:[2,7],
            }
          },
          object:"line",
        },
        {
          annotJson:{
            type:'circle', title:"title", subject:"circle", name:'name', contents:'contents',
            opacity:0.75, color:0xffff00, fillColor:0x00ffff, flags:4, rect:{left:450,right:500,top:700,bottom:650},
            borderInfo:{
              width:6, style:1, cloudIntensity:2, dashPhase:4, dashes:[3,7],
            }
          },
          object:"circle",
        },
        {
          annotJson:{
            type:'square', title:"title", subject:"square", name:'name', contents:'contents',
            opacity:0.75, color:0xff0000, fillColor:0xff00ff, flags:8, rect:{left:50,right:100,top:600,bottom:550},
            borderInfo:{
              width:5, style:1, cloudIntensity:2, dashPhase:4, dashes:[3,7],
            }
          },
          object:"square",
        },
        {
          annotJson:{
            type:'polygon', title:"title", subject:"polygon", contents:'contents', name:'name', intent:"PolygonCloud",
            opacity:1, color:0x00ffff, fillColor:0x00ffff, flags:4,
            rect:{left:150,right:200,top:600,bottom:550}, vertexes:[{x:150,y:550},{x:150,y:600},{x:200,y:600}],
            borderInfo:{
              width:4, style:5, cloudIntensity:2, dashPhase:1, dashes:[2,7],
            }
          },
          object:"polygon",
        },
        {
          annotJson:{
            type:'polyline', title:"title", subject:"polyline", contents:'contents', name:'name', intent:"PolyLineDimension",
            opacity:1, color:0x00ffff, flags:4, rect:{left:250,right:300,top:600,bottom:550}, vertexes:[{x:250,y:550},{x:250,y:600},{x:300,y:600}],
            borderInfo:{
              width:4, style:0, cloudIntensity:1, dashPhase:1, dashes:[2,7],
            }
          },
          object:"polyline",
        },
        {
          annotJson:{
            type:'screen', contents:'contents', name:'name', color:0x00ffff, flags:4, rect:{left:450,right:500,top:600,bottom:550},
            borderInfo:{
              width:4, style:1, cloudIntensity:1, dashPhase:1, dashes:[2,7],
            }
          },
          object:"screen",
        },
        {
          annotJson:{
            type:'link', title:"title", subject:"link", contents:'contents', name:'name',
            opacity:0.75, color:0xff0000, flags:0, rect:{left:350,right:400,top:500,bottom:450},
            borderInfo:{
              width:4, style:0, cloudIntensity:1, dashPhase:1, dashes:[2,7],
            },
          },
          object:"link",
        },
      ];
    
      let doc = await Foxit.ReaderApp.getActiveDoc();
    
      tests.forEach(async(test)=> {
        await doc.addAnnot(0,test.annotJson).then(function (ret) {
          if(typeof(ret) === 'object'){
            result.push('addAnnot   ' + test.object + '   success');
          }
          else{
            result.push('addAnnot   ' + test.object + '   fail');
          }
        });
      });
    
      await sleep(500);
      for(let i=0;i<result.length;i++){
        tmp += result[i] + '\n';
      }
      console.log(tmp);
    };
    

addEmbeddedFileByAttachments

  • addEmbeddedFileByAttachments(attachOption: AttachmentOption): Promise<boolean>
  • add embeded file.

    see

    Doc

    see

    AttachmentOption

    Parameters

    Returns Promise<boolean>

    • When before returns false, the promise returns reject

addHeaderFooter

  • Add new header-footer.

    see

    Doc

    see

    PageNumberFormat

    Parameters

    • headerFooter: HeaderFooterOptions

      A json object specify configuration of header footer

      var headerFooter = {
         contentFormats: {
            TopLeft: 'abc <<1 of n>> <<mm.dd.yy>>',
            TopRight: "20",
            BottomCenter: "4",
          },
          margin: { left: 20, right: 20, top: 20, bottom: 20 },
          textSize: 10,
          textColor: 0x00ff00,
          hasTextShrinked: true,
          hasFixedSized: true,
          startPageNumber: 10,
          underline: true,
      }
         const doc = await Foxit.ReaderApp.getActiveDoc();
         let ret = await doc.addHeaderFooter(headerFooter);
      

    Returns Promise<boolean>

    • A null for failed or success.

addPagingSealSignature

  • brief

    Add a paging seal signature field into specified pages.

    see

    AddPagingInfo

    code
    // pageRange min value is 0, max value is pageCount - 1
    async function example() {
        let pdfDoc = await Foxit.ReaderApp.getActiveDoc();
        let pagingSigConfig = {
            width: 100,
            height: 100,
            position: 'bottom',
            offset: 0,
            pageRange: [1, 6],
            firstPagePercent: 0.5,
            image: 'data:image/png;base64,iVBORw0...',
        };
        let pagingSigObjNum = await pdfDoc.addPagingSealSignature({ pagingSigConfig });
    }
    
    endcode

    Parameters

    Returns Promise<number>

    Promise - Paging seal signature object number.

close

  • close(): Promise<void>
  • Close the open document.

    see

    Doc

    Returns Promise<void>

    • When before returns false, the promise returns reject

createRootBookmark

  • createRootBookmark(): Promise<null | BookMark>
  • Create the root bookmark of the document.

    see

    Doc

    Returns Promise<null | BookMark>

    • root bookmark.

duplicatePage

  • duplicatePage(pageRange: number[][], destIndex: number): Promise<void>
  • Duplicate Pages

    Parameters

    • pageRange: number[][]

      A two-dimensional array of page indices(starts from 0) which would be duplicate. Only positive integer in valid page range is available. For example, [[0],[2,4],[5,7]] means page 0, page 2 to page 3, and page 5 to page 6 will be duplicate.

    • destIndex: number

      Insert to this PageIndex

    Returns Promise<void>

exportAnnotsToFDF

  • exportAnnotsToFDF(fileType?: FileType, annots?: Annot[]): Promise<undefined | Blob>
  • Export annotation data in a document to a file.

    see

    Doc

    Parameters

    • fileType: FileType = ...

      Specify data file type. xfdf or fdf. The default is fdf.

    • annots: Annot[] = []

      Specifies particular annots to be exported. If it's null, all annotations will be exported. only support annot type:Care, Circle, Fileattachment, Freetext,Ink,Line, Note, Polygon, PolyLine, Redact, Sound, Square, Stamp, TextMarkup

    Returns Promise<undefined | Blob>

    • Blob of annotations data.

exportAnnotsToJSON

  • exportAnnotsToJSON(annots?: Annot[]): Promise<undefined | Object>
  • Export the document's annotation data to Json.

    see

    Doc

    Parameters

    • annots: Annot[] = []

      An array with annots that will be exported. All annots will be exported with "null" parameters.

    Returns Promise<undefined | Object>

    • Json format. please refer to Annot::exportToJson

exportFormToFile

  • exportFormToFile(filetype: number): Promise<undefined | Blob>
  • Export document form data to file.

    see

    Doc

    see

    FileType

    Parameters

    • filetype: number

      Specify data file type. Please refer to FileType.

    Returns Promise<undefined | Blob>

    • Blob of form data.

extractPages

  • extractPages(pageIndexes: number[]): Promise<null | ArrayBuffer>
  • Export the given page(s) from the current document.

    see

    Doc

    Parameters

    • pageIndexes: number[]

      A two-dimensional array of page indices(starts from 0) which woulb be extracted.
      Only positive integer in valid page range is available. For example, [[0],[2,4],[5,7]] means page 0, page 2 to page 3, and page 5 to page6 will be extracted.

    Returns Promise<null | ArrayBuffer>

    • Array buffer of PDF document.

flatten

  • Flatten all annotations and interactive form fields in a PDF.

    see

    Doc

    see

    FlattenOptions

    Parameters

    Returns Promise<boolean[]>

    • success flag.

getCurDocView

  • getCurDocView(): Promise<null | DocView>
  • Get the active DocView of this document.

    see

    DocView

    Returns Promise<null | DocView>

    Current active DocView object.

getCurrentDocblob

  • getCurrentDocblob(): Promise<Blob>
  • Get Current doc's Blob object.

    Returns Promise<Blob>

getDocType

  • getDocType(): Promise<string>
  • Get the type of this document.

    Returns Promise<string>

getDocViewCount

  • getDocViewCount(): Promise<number>
  • Get the count of DocView of this document.

    see

    DocView

    Returns Promise<number>

getFonts

  • getFonts(): Promise<FontInfo[]>
  • Get fonts info.

    see

    Doc

    Returns Promise<FontInfo[]>

    • Fonts info.

getForm

  • getForm(): Promise<Form>
  • Get form object of PDF Document.

    see

    Form

    Returns Promise<Form>

getHeaderFooter

  • Get HeaderFooter of document.

    see

    Doc

    Returns Promise<HeaderFooterOptions>

    • If no header or footer presents, a null return.

getMetadata

  • getMetadata(): Promise<Metadata>
  • Get metadata of PDF document.

    see

    Doc

    Returns Promise<Metadata>

getPageAnnots

  • getPageAnnots(index: number): Promise<Annot[]>
  • Get all annotations in a specified page by page index.

    see

    Doc

    Parameters

    • index: number

      page index

    Returns Promise<Annot[]>

    • Annotation objects.

getPageByIndex

  • getPageByIndex(index: number): Promise<false | Page>
  • Get the document page

    see

    Doc

    Parameters

    • index: number

      Access 0 to this.getPageCount() - 1

    Returns Promise<false | Page>

    • PDFPage

getPageCount

  • getPageCount(): Promise<number>
  • Gets the number of document pages

    see

    Doc

    Returns Promise<number>

    • Pages count.

getPageEditor

  • getPageEditor(): Promise<null | PageEditor>
  • Get the PageEditor of this document.

    see

    [[PageEditor]]

    Returns Promise<null | PageEditor>

    The PageEditor of this document.

getPageLabels

  • getPageLabels(pageIndexes: number[]): Promise<undefined | string[]>
  • Get the page labels of the pdf document.

    see

    Doc

    Parameters

    • pageIndexes: number[]

      Could be undefined or page number indexes array. If it's undefined, then all the page labels are returned.

    Returns Promise<undefined | string[]>

    • The page labels array.

getPasswordType

  • getPasswordType(): Promise<string>
  • Get the type of current used password.

    see

    Doc

    Returns Promise<string>

    • 1 means no password, 2 means user password, 3 means owner password.

getPermissions

  • getPermissions(): Promise<number>
  • Get user access permissions. If it is the owner of the document, then 4294967292 is put back to indicate full permissions.

    see

    Doc

    Returns Promise<number>

    User access permission.

getRootBookmark

  • getRootBookmark(): Promise<null | BookMark>
  • Get the root bookmark of the document.

    see

    Doc

    Returns Promise<null | BookMark>

    • root bookmark. Null if no one.

getUserPermissions

  • getUserPermissions(): Promise<number>
  • Get user access permissions.
    If current user is the owner of the document, then 4294967292 is put back to indicate full permissions.

    Returns Promise<number>

hasForm

  • hasForm(): Promise<boolean>
  • Call this function to determine whether the document contains pdf form.

    see

    Doc

    Returns Promise<boolean>

    true means the document contains form, false otherwise

importAnnotsFromFDF

  • importAnnotsFromFDF(fdf: ArrayBuffer, escape?: boolean): Promise<void>
  • Import data from an FDF file specified by array buffer.

    see

    Doc

    Parameters

    • fdf: ArrayBuffer

      Specify fdf file's stream

    • escape: boolean = true

      Skip annotationImportedEx event

    Returns Promise<void>

importAnnotsFromJSON

  • importAnnotsFromJSON(annotsJson: Object): Promise<void>
  • Import data from Json.

    see

    Doc

    see

    exportAnnotsToJSON

    Parameters

    • annotsJson: Object

      Specify annots' json array.

    Returns Promise<void>

importFormFromFile

  • importFormFromFile(file: Blob, format: FileType, encoding?: string): Promise<void>
  • Import form data from an FDF file specified by array buffer.

    see

    Doc

    see

    FileType

    Parameters

    • file: Blob

      Specify fdf file's stream.

    • format: FileType

      File format. Please refer to FileType.

    • encoding: string = 'UTF-8'

      File encoding. Available values are same as second parameter of FileReader.readAsText. default value:"UTF-8"

    Returns Promise<void>

insertBlankPage

  • insertBlankPage(pageIndex: number, width: number, height: number): Promise<null | Page>
  • Insert a new blank PDF page to document, by index.

    see

    [[Page]]

    Parameters

    • pageIndex: number

      The page index for new page.

    • width: number

      Width of new page.

    • height: number

      Height of new page.

    Returns Promise<null | Page>

    • A new PDFPage object which represents a blank page.

insertBlankPages

  • insertBlankPages(pageIndexes: number[], width: number, height: number): Promise<null | Page[]>
  • Insert a new blank PDF page to the specified pages, by indexes.

    see

    [[Page]]

    note

    foreach call insertBlankPage

    Parameters

    • pageIndexes: number[]

      A two-dimensional array of page indices(starts from 0) which would be inserted.
      Only positive integer in valid page range is available. For example, [[0],[2,4],[5,7]] means page 0, page 2 to page 3, and page 5 to page6 will be inserted.

    • width: number

      Width of new page.

    • height: number

      Height of new page.

    Returns Promise<null | Page[]>

    • The new PDFPage objects which represents these blank pages.

insertPage

  • insertPage(pageIndex: number, width: number, height: number): Promise<any>
  • Insert a new blank PDF page to document, by index.

    see

    [[Page]]

    Parameters

    • pageIndex: number

      The page index for new page.

    • width: number

      Width of new page.

    • height: number

      Height of new page.

    Returns Promise<any>

    • A new PDFPage object which represents a blank page.

insertPages

  • insertPages(insertOptions: InsertOptions): Promise<null | Page[]>
  • Start to import pages from another PDF document.

    see

    [[insertOptions]]

    Parameters

    Returns Promise<null | Page[]>

    • Page information array.

isDocModified

  • isDocModified(): Promise<boolean>
  • Call this function to determine whether the document is modified if modified return true, false otherwise.

    see

    Doc

    Returns Promise<boolean>

isExistFileAttachmentByName

  • isExistFileAttachmentByName(fileName: string): Promise<boolean>
  • check embeded file is exist.

    see

    Doc

    Parameters

    • fileName: string

      string - Attachment name

    Returns Promise<boolean>

    • When before returns false, the promise returns reject

isLinearized

  • isLinearized(): Promise<boolean>
  • Call this function to determine whether the document is represented in linearized (fast web view) format.

    see

    Doc

    Returns Promise<boolean>

    true means linearized, false otherwise

isPortfolio

  • isPortfolio(): Promise<boolean>
  • Check document is a portfolio.

    Returns Promise<boolean>

isStaticXFA

  • isStaticXFA(): Promise<boolean>
  • Check document is a static XFA.

    Returns Promise<boolean>

loadForm

  • loadForm(): Promise<Form>
  • Load form data of PDF document.

    see

    Form

    Returns Promise<Form>

movePageTo

  • movePageTo(pageIndex: number, destIndex: number): Promise<boolean>
  • Move a specified page to a new index position.

    see

    Doc

    Parameters

    • pageIndex: number

      Index of the specified page.

    • destIndex: number

      Index of the destination position.

    Returns Promise<boolean>

    • TRUE means success, while FASLE means failure.

movePagesTo

  • movePagesTo(pageIndexes: number[], destIndex?: number): Promise<undefined | fxPage[]>
  • Move the specified pages to a new index position.

    see

    Doc

    Parameters

    • pageIndexes: number[]

      A two-dimensional array of page indices(starts from 0) which would be moved. Only positive integer in valid page range is available. For example, [[0],[2,4],[5,7]] means page 0, page 2 to page 3, and page 5 to page6 will be moved.

    • destIndex: number = 0

      A page index in current PDF document. Default value:0. If less than 0 or more than total page, will throw error.

    Returns Promise<undefined | fxPage[]>

    • pages array.

protectDoc

  • protectDoc(pluginId: string, filter: string): Promise<boolean>
  • protect Doc, all of the content will be encrypted when saving the document, depending on registerSecurityHandler functoin.

    see

    registerSecurityHandler

    Parameters

    • pluginId: string
    • filter: string

    Returns Promise<boolean>

    true: success false: fail

removeEmbeddedFileByAttachments

  • removeEmbeddedFileByAttachments(fileName: string): Promise<boolean>
  • remove embeded file.

    Parameters

    • fileName: string

    Returns Promise<boolean>

removeHeaderFooter

  • removeHeaderFooter(): Promise<boolean>
  • Revmove all headers and foonters of document.

    see

    Doc

    Returns Promise<boolean>

removePage

  • removePage(pageIndex: number): Promise<undefined | boolean>
  • Remove a PDF page by page index.

    see

    Doc

    Parameters

    • pageIndex: number

      Index of the specified page.

    Returns Promise<undefined | boolean>

    • TRUE means success, while FASLE means failure.

removePages

  • removePages(pageIndexes: number[]): Promise<boolean>
  • Remove the specified pages by page indexes.

    see

    Doc

    Parameters

    • pageIndexes: number[]

      A two-dimensional array of page indices(starts from 0) which would be removed. Only positive integer in valid page range is available. For example, [[0],[2,4],[5,7]] means page 0, page 2 to page 3, and page 5 to page6 will be removed.

    Returns Promise<boolean>

    • TRUE means success, while FALSE means failure.

removePagingSealSignature

  • removePagingSealSignature(info: RemoveInfo): Promise<void>
  • brief

    Remove paging seal signature. All signature associated with paging seal signature will be removed.

    code

    see addPagingSealSignature to get pagingSigObjNums

    async function example() {
        let pdfDoc = await Foxit.ReaderApp.getActiveDoc();
        await pdfDoc.removePagingSealSignature({ pagingSigObjNum });
    }
    
    endcode

    Parameters

    Returns Promise<void>

    Promise

replacePage

  • Using the new document, replace the specified page of the old document

    see

    ReplaceOptions

    Parameters

    Returns Promise<void>

reversePage

  • reversePage(pageRange: number[]): Promise<void>
  • Reverse Pages

    Parameters

    • pageRange: number[]

      Page indexs

    Returns Promise<void>

rotatePages

  • rotatePages(pageIndexes: number[], rotation: 0 | 90 | 180 | 270): Promise<void>
  • Set the specified pages rotation.

    see

    Doc

    Parameters

    • pageIndexes: number[]

      A two-dimensional array of page indices(starts from 0) which would be rotated. Only positive integer in valid page range is available. For example, [[0],[2,4],[5,7]] means page 0, page 2 to page 3, and page 5 to page6 will be rotated.

    • rotation: 0 | 90 | 180 | 270

      Rotation to be set. the value is 0 | 80 | 180 | 270.

    Returns Promise<void>

    void

setChangeMark

  • setChangeMark(): Promise<void>
  • Call this function to notify that this document is modified.

    Returns Promise<void>

setEmbeddedFileByAttachments

  • setEmbeddedFileByAttachments(attachOption: AttachmentOption): Promise<boolean>
  • update embeded file.

      const reader = new FileReader();
         reader.onload = async () => {
       let attachOption = {
         fileName: file.name,
         buffer: new Uint8Array(reader.result),
         modifiedDateTime: file.lastModifiedDate,
       };
       const doc = await Foxit.ReaderApp.getActiveDoc();
       let ret = await doc.setEmbeddedFileByAttachments(attachOption);
    

    Parameters

    Returns Promise<boolean>

setMetadataValue

  • setMetadataValue(key: keyof Metadata, value: string): Promise<void>
  • Set metadata value.

    Parameters

    • key: keyof Metadata

      Metadata key string. It should not be an empty string.
      Currently it can be one of the following keys: "Title", "Author", "Subject", "Keywords", "Creator", "Producer", "Trapped", "CreationDate", "ModDate", "pdfaid".
      It can also be some other custom information keys if they're supported by the PDF file.

    • value: string

      An string value of metadata value.

    Returns Promise<void>

    void

setPasswordAndPermission

  • setPasswordAndPermission(userPassword: string, ownerPassword: string, permission?: number, cipher: "aes256" | "aes128" | "rc4", isEncryptMetaData?: boolean): Promise<boolean>
  • Set document password and permission.

    see

    Doc

    Parameters

    • userPassword: string

      user password.

    • ownerPassword: string

      owner password.

    • permission: number = 0xfffffffc

      User_Permissions 32bit numbers, Print PDF document with normal mode. (Bit 3 );
      Modify PDF contents. (Bit 4);
      Extract PDF contents. (Bit 5);
      Operate text annotations and fill in interactive form fields. (Bit 6);
      Fill PDF form. (Bit 9);
      Disabilities support. (Bit 10);
      Assemble PDF document. (Bit 11);
      Print PDF document with higher qualities. (Bit 12);

    • cipher: "aes256" | "aes128" | "rc4"

      Cipher type string. Available values: "rc4", "aes128", "aes256"

    • isEncryptMetaData: boolean = true

      boolean - true means to encrypt metadata, and false means not to encrypt metadata

    Returns Promise<boolean>

    • TRUE means success, while FASLE means failure

splitDocByBlankPage

  • splitDocByBlankPage(): Promise<number | ArrayBuffer>
  • split doc by blank page. return array buffer if it's success, -1 otherwise.

    Returns Promise<number | ArrayBuffer>

splitDocByMaxPages

  • splitDocByMaxPages(maxPage: number): Promise<undefined | number | ArrayBuffer>
  • split doc by max pages. return array buffer if it's success, -3 otherwise. -3: maspage > pagecount

    Parameters

    • maxPage: number

      max page

    Returns Promise<undefined | number | ArrayBuffer>

splitDocByPageRange

  • splitDocByPageRange(pageRange: string): Promise<undefined | number | ArrayBuffer>
  • split doc by page range. return array buffer if it's success, -4 otherwise. -4: parse pageRange error.

    Parameters

    • pageRange: string

      the page range.
      If you want to print pages 3,5 and 8 enter "3,5,8".
      If you want to print pages from 3 to8, enter "3-8" in the text box.

    Returns Promise<undefined | number | ArrayBuffer>

splitDocByTopLevelBookmark

  • splitDocByTopLevelBookmark(): Promise<number | ArrayBuffer>
  • split doc by top level bookmark. return array buffer if it's success, -2 otherwise. -2: no bookmarks.

    Returns Promise<number | ArrayBuffer>

swapPage

  • swapPage(swapPage: number, forPage: number): Promise<any>
  • swap page

    Parameters

    • swapPage: number
    • forPage: number

    Returns Promise<any>

updateHeaderFooter

  • Modify header or footer of documents. If there is no header or footer, this function will add one.

    see

    Doc

    Parameters

    Returns Promise<boolean>

updatePagingSealSignature

  • brief

    Update paging seal signature.

    see

    UpdatePagingInfo

    code

    see addPagingSealSignature to get pagingSigObjNums

    // pageRange min value is 0, max value is pageCount - 1
    async function example() {
        let pdfDoc = await Foxit.ReaderApp.getActiveDoc();
        let pagingSigConfig = {
            width: 100,
            height: 100,
            position: 'bottom',
            offset: 0,
            pageRange: [1, 6],
            firstPagePercent: 0.5,
            image: 'data:image/png;base64,iVBORw0...',
        };
        let pagingSigObjNum = await pdfDoc.updatePagingSealSignature({ pagingSigConfig, pagingSigObjNum });
    }
    
    endcode

    Parameters

    Returns Promise<number>

    Promise - Paging seal signature object number.