Skip to main content

Type Definitions

TiledWatermark

Tiled watermark object.

  • When line1 is not empty, tiled watermark is tiled text watermark.
  • When picUrl is not empty, tiled watermark is tiled image watermark.
  • When both line1 and picUrl are not empty, tiled watermark is tiled text watermark.
  • When both line1 and picUrl are empty, tiled watermark is tiled text watermark using default configuration.

Tiled Text Watermark

AttributeTypeRequiredDescription
line1stringYesWatermark content. Default empty
line2stringNoWatermark content 2. Default empty.
line3stringNoWatermark content 3. Default empty.
line4stringNoWatermark content 4. Default empty.
withDatebooleanYesWhether watermark includes date. Default value true.
fontstringYesFont. Default SimHei.
fontcolorstringYesFont color. Color value is 6-digit hexadecimal color value
fontsizestringYesFont size. Default value 16.
isFontBoldbooleanNoWhether watermark font is bold. Only supported when operating images, ofd.
isFontItalicbooleanNoWhether watermark font is italic. Only supported when operating images, ofd
transparentnumberYesWatermark transparency. Default value 70.
rotationnumberYesWatermark tilt angle. Default value 315.
spacingnumberYesWatermark spacing. Default value 50.

Tiled Image Watermark

AttributeTypeRequiredDescription
picUrlstringYesImage download address. Download image request will set token according to tokenType and tokenValue description
picNamestringYesImage name with extension. Supports png/jpeg.
picScalenumberNoImage scaling ratio. When operating images, parameter value range is (0-200)
transparentnumberYesWatermark transparency When operating images, parameter value range is (0-100)
rotationnumberYesRotation angle.
spacingnumberYesImage spacing.

TextWatermark

Position text watermark

AttributeTypeRequiredDescription
textstringYesWatermark content
fontcolorstringYesFont color. Color value is 6-digit hexadecimal color value
fontsizestringYesFont size. Value range [1, 72], larger value means larger watermark. ofd format default 16
fontstringYesFont.
isFontBoldbooleanNoWhether watermark font is bold. Only supported when operating images, ofd.
isFontItalicbooleanNoWhether watermark font is italic. Only supported when operating images, ofd
transparentnumberNoWatermark transparency, value range [0, 100]
rotationnumberNoRotation angle
positionenumNoWatermark position, parameter description see Type/WatermarkPosition

MsPicWatermark

Position image watermark

AttributeTypeRequiredDescription
picUrlstringYesImage download address. Download image request will set token according to tokenType and tokenValue description
picNamestringYesImage name with extension. Supports jpg/jpeg/png/bmp Source file type docx/wps/doc only supports jpg/png
picScalenumberNoImage scaling ratio (0-200) Source file type docx/wps/doc supports range [50, 500]
isErosionbooleanNoWhether there is erosion effect, default false Only supported when source file type is docx/wps/doc
transparentnumberNoWatermark transparency (0-100). Source file type docx/wps/doc does not support
rotationnumberNoImage rotation angle.
positionenumNoWatermark position, default CENTER, parameter description see Type/WatermarkPosition
widthInCmnumberNoImage width, unit cm Only supported when source file type is docx/wps/doc
heightInCmnumberNoImage height, unit cm Only supported when source file type is docx/wps/doc

WatermarkPosition

Watermark position enum

ValueDescription
TOP_LEFTTop left
TOP_CENTERTop center
TOP_RIGHTTop right
CENTER_LEFTCenter left
CENTERCenter
CENTER_RIGHTCenter right
BOTTOM_LEFTBottom left
BOTTOM_CENTERBottom center
BOTTOM_RIGHTBottom right

Excel2PdfOptions

AttributeOption TypeRequiredDescription
typeenumNoPrint type, optional values:
* range: print specified range, range set in selectRange
* allSheet: print entire workbook, default value
selectRangeRangeRequired when type is rangePrint range
paperSizenumberNoPaper type, default paper size A4. Optional values:
* 1: Letter
* 8: A3
* 9: A4
* 12: B4
* 13: B5
orientationenumNoPaper orientation, default value portrait. Optional values:
* portrait: Portrait
* landscape: Landscape
centerOnPageTypeCenterOnPageTypeNoPage centering method
showGridLinebooleanNoWhether to show grid lines, default is false
orderenumNoPrint order, default value overThenDown. Optional values:
* downThenOver: Column first then row
* overThenDown: Row first then column
localeenumNoLocale, default language Simplified Chinese. Optional values
* zh-cn: Simplified Chinese
* zh-tw: Traditional Chinese
* zh-hk: Hong Kong Chinese
* en: English
* en-us: US English
* ja: Japanese
customPagePaddingPagePaddingNoPaper margins

Example

  1. Print all sheets

    {
    "excel2pdfOptions": {
    "type": "allSheet"
    }
    }
  2. Print content between B5:G19 in Sheet1

    {
    "excel2pdfOptions": {
    "type": "range",
    "selectRange": {
    "sheetName": "Sheet1",
    "startRow": 5,
    "startCol": 2,
    "endRow": 19,
    "endCol": 7
    }
    }
    }
  3. Print all sheets on B4 paper landscape, and show grid lines, print order column first then row

    {
    "excel2pdfOptions": {
    "type": "allSheet",
    "paperSize": 12,
    "orientation": "landscape",
    "showGridLine": true,
    "order": "downThenOver"
    }
    }

Range

When setting Range, all parameters below must be set
Parameter NameParameter TypeParameter Description
sheetNamestringWorksheet name to print
startRownumberStarting row of print range
startColnumberStarting column of print range
endRownumberEnding row of print range
endColnumberEnding column of print range

CenterOnPageType

Parameter NameParameter TypeRequiredParameter Description
verticalCenteredbooleanNoWhether vertically centered (default false)
horizontalCenteredbooleanNoWhether horizontally centered (default false)

PagePadding

When setting PagePadding, all parameters below must be set
Parameter NameParameter TypeParameter Description
topnumberTop margin (default 1.91cm)
bottomnumberBottom margin (default 1.91cm)
leftnumberLeft margin (default 1.78cm)
rightnumberRight margin (default 1.78cm)
headernumberHeader (default 0.76cm)
footernumberFooter (default 0.76cm)

toPicOptions

AttributeOption TypeRequiredDescription
startnumberNoConversion starting page, counting from 1, controls output range.
endnumberNoConversion ending page, end needs to be greater than or equal to start, (if start and end are not passed, default is convert all)
longPicTypeenumNoStitch images after conversion, stitching method (optional values: MD/TD) (vertical/horizontal), if not passed default is no stitching. Word to image does not support stitching.