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

The PDFPageBatchProcessor class controls the start, flush, and end cycles of a batch processor, and calling property update methods within the batch processor declaration cycle can greatly improve performance. More...

Public Member Functions

Promise< void > end ()
 End this bacth processor, and flush all cached operations. This method must be called within the finally block of try{}finally{}. More...
 
Promise< void > flush ()
 Flush all cached operations before ending. More...
 
Promise< void > start ()
 Start this batch procesor, after starting we can update the properties of the PDF object. More...
 

Detailed Description

The PDFPageBatchProcessor class controls the start, flush, and end cycles of a batch processor, and calling property update methods within the batch processor declaration cycle can greatly improve performance.

Note
Currently this APIs is only available for GraphicsObject.
Since
9.0.0 Example:
async function updateAllTextObjects(pageIndex) {
const curDoc = await pdfui.getCurrentPDFDoc();
const page = await curDoc.getPageByIndex(pageIndex);
const graphicsObjectCount = await page.getGraphicsObjectsCount();
const batch = page.getBatchProcessor();
try {
batch.start();
for (let i = 0; i < graphicsObjectCount; i++) {
const pageObj = await page.getGraphicsObjectByIndex(i);
if(!pageObj) {
continue;
}
var objType = pageObj.getType();
if (objType == 1) { // Text Object
await pageObj.setOpacity(1);
await pageObj.setFillColor(0xFF000000 | Math.floor(0xFFFFFF * Math.random()));
}
}
} finally {
batch.end();
}
}

Member Function Documentation

◆ end()

Promise<void> PDFPageBatchProcessor::end ( )

End this bacth processor, and flush all cached operations. This method must be called within the finally block of try{}finally{}.

Since
9.0.0
Returns
Promise<void> -

◆ flush()

Promise<void> PDFPageBatchProcessor::flush ( )

Flush all cached operations before ending.

Since
9.0.0
Returns
Promise<void> -

◆ start()

Promise<void> PDFPageBatchProcessor::start ( )

Start this batch procesor, after starting we can update the properties of the PDF object.

Since
9.0.0
Returns
Promise<void> -

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