FoxitPDFSDKforWeb v12.0.0
Foxit PDF SDK for Web
CompareDocumentParamsService Class Reference

Service for reading and writing comparison-options dialog parameters (Include checkboxes, marking color, opacity, line thickness). More...

Public Member Functions

async getDefaultOptions ()
 Returns a copy of the persisted comparison-options defaults the dialog loads on open. Color values are always 0xRRGGBB numbers. Waits for options storage initialization. More...
 
async getOptions ()
 Returns a copy of the current comparison-options dialog parameters. Color values are always 0xRRGGBB numbers. Waits for options storage initialization. More...
 
 onOptionsUpdated (callback:(options:CompareDocumentParams)=> void)
 Subscribe to comparison-options changes from the API or the options dialog. If options already have a value, the callback is invoked immediately with the current options when subscribing. More...
 
async setCompareTable (compareTable:boolean)
 Set whether the next comparison includes table differences. More...
 
async setCompareTextOnly (compareTextOnly:boolean)
 Set whether the next comparison includes text-only differences. More...
 
async setDefaultOptions (options:CompareDocumentParamsPatch)
 Merge a partial snapshot into the persisted defaults the options dialog loads on open. Omitted keys keep their current default values. This does not change the current options used by the next compare(); call setOptions for that. More...
 
async setDetectPageDeletionsOrInserts (detectPageDeletionsOrInserts:boolean)
 Set whether the next comparison detects page deletions or inserts. More...
 
async setLineThickness (lineThickness:Partial< Option< number >>)
 Set marking line thickness per change type (1–12). Omitted keys keep their current values. Values are rounded and clamped to 1–12. More...
 
async setMarkingColor (markingColor:Partial< Option< number|string >>)
 Set marking colors used to highlight replace, insert, and delete changes. Omitted keys keep their current values. Invalid color values are ignored. More...
 
async setOpacity (opacity:Partial< Option< number >>)
 Set marking opacity per change type (0–100). Omitted keys keep their current values. Values are rounded and clamped to 0–100. More...
 
async setOptions (options:CompareDocumentParamsPatch)
 Merge a partial snapshot into the current options used by the next compare(). Omitted keys keep their current values. This does not change getDefaultOptions(); call setDefaultOptions to persist dialog defaults. More...
 

Detailed Description

Service for reading and writing comparison-options dialog parameters (Include checkboxes, marking color, opacity, line thickness).

Per-field setters wait for options storage initialization, then update both the current options used by the next compare() and the persisted defaults the dialog loads on open. setOptions updates only the current options. setDefaultOptions updates only the persisted defaults.

Since
12.0.0
See also
ComparisonAddon.getCompareDocumentParamsService
Option
CompareDocumentParams
CompareDocumentParamsPatch
const addon = await pdfui.getAddonInstance('Comparison');
const service = addon.getCompareDocumentParamsService();
await service.setCompareTextOnly(true);
await service.setMarkingColor({
replace: 0xFFCC00,
insert: '#149BFF',
delete: 0xFA0005
});
const options = await service.getOptions();

Member Function Documentation

◆ getDefaultOptions()

async CompareDocumentParamsService::getDefaultOptions ( )
inline

Returns a copy of the persisted comparison-options defaults the dialog loads on open. Color values are always 0xRRGGBB numbers. Waits for options storage initialization.

Returns
Promise<CompareDocumentParams>
Since
12.0.0
const defaults = await service.getDefaultOptions();

◆ getOptions()

async CompareDocumentParamsService::getOptions ( )
inline

Returns a copy of the current comparison-options dialog parameters. Color values are always 0xRRGGBB numbers. Waits for options storage initialization.

Returns
Promise<CompareDocumentParams>
Since
12.0.0
const options = await service.getOptions();

◆ onOptionsUpdated()

CompareDocumentParamsService::onOptionsUpdated (   callback:(options:CompareDocumentParams),
  void 
)
inline

Subscribe to comparison-options changes from the API or the options dialog. If options already have a value, the callback is invoked immediately with the current options when subscribing.

Parameters
callback(options: CompareDocumentParams) => void
Returns
Function - Unsubscribe.
Since
12.0.0
const unsubscribe = service.onOptionsUpdated(options => {
console.log(options.compareTable);
});

◆ setCompareTable()

async CompareDocumentParamsService::setCompareTable (   compareTable:boolean)
inline

Set whether the next comparison includes table differences.

Parameters
compareTableboolean - Compare Table checkbox value.
Returns
Promise<void>
Since
12.0.0

◆ setCompareTextOnly()

async CompareDocumentParamsService::setCompareTextOnly (   compareTextOnly:boolean)
inline

Set whether the next comparison includes text-only differences.

Parameters
compareTextOnlyboolean - Compare Text Only checkbox value.
Returns
Promise<void>
Since
12.0.0

◆ setDefaultOptions()

async CompareDocumentParamsService::setDefaultOptions (   options:CompareDocumentParamsPatch)
inline

Merge a partial snapshot into the persisted defaults the options dialog loads on open. Omitted keys keep their current default values. This does not change the current options used by the next compare(); call setOptions for that.

Parameters
optionsCompareDocumentParamsPatch - Partial snapshot. Same color, opacity, and line-thickness rules as setOptions.
Returns
Promise<void>
Since
12.0.0
See also
CompareDocumentParamsPatch
await service.setDefaultOptions({
compareTextOnly: true,
markingColor: { insert: '#00FF00' }
});

◆ setDetectPageDeletionsOrInserts()

async CompareDocumentParamsService::setDetectPageDeletionsOrInserts (   detectPageDeletionsOrInserts:boolean)
inline

Set whether the next comparison detects page deletions or inserts.

Parameters
detectPageDeletionsOrInsertsboolean - Detect Page Deletions or Inserts checkbox value.
Returns
Promise<void>
Since
12.0.0

◆ setLineThickness()

async CompareDocumentParamsService::setLineThickness (   lineThickness:Partial< Option< number >>)
inline

Set marking line thickness per change type (1–12). Omitted keys keep their current values. Values are rounded and clamped to 1–12.

Parameters
lineThicknessPartial<Option<number>> - Per-change-type line thickness.
Returns
Promise<void>
Since
12.0.0
await service.setLineThickness({ replace: 4 });

◆ setMarkingColor()

async CompareDocumentParamsService::setMarkingColor (   markingColor:Partial< Option< number|string >>)
inline

Set marking colors used to highlight replace, insert, and delete changes. Omitted keys keep their current values. Invalid color values are ignored.

Parameters
markingColorPartial<Option<number|string>> - Per-change-type colors. Each value may be a 0xRRGGBB number or a #RRGGBB / RRGGBB string.
Returns
Promise<void>
Since
12.0.0
await service.setMarkingColor({
replace: 0xFFCC00,
insert: '#149BFF',
delete: 0xFA0005
});

◆ setOpacity()

async CompareDocumentParamsService::setOpacity (   opacity:Partial< Option< number >>)
inline

Set marking opacity per change type (0–100). Omitted keys keep their current values. Values are rounded and clamped to 0–100.

Parameters
opacityPartial<Option<number>> - Per-change-type opacity percentages.
Returns
Promise<void>
Since
12.0.0
await service.setOpacity({ insert: 40 });

◆ setOptions()

async CompareDocumentParamsService::setOptions (   options:CompareDocumentParamsPatch)
inline

Merge a partial snapshot into the current options used by the next compare(). Omitted keys keep their current values. This does not change getDefaultOptions(); call setDefaultOptions to persist dialog defaults.

Parameters
optionsCompareDocumentParamsPatch - Partial snapshot. markingColor values may be 0xRRGGBB numbers or #RRGGBB / RRGGBB strings. Opacity is clamped to 0–100. Line thickness is clamped to 1–12. Invalid color or number keys are ignored.
Returns
Promise<void>
Since
12.0.0
See also
CompareDocumentParamsPatch
await service.setOptions({
compareTable: true,
opacity: { insert: 40 }
});

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