Skip to main content

PDF-Stamp-OCR

Command Description

Using the Laiye IDP recognizes the seal information in the PDF file, the recognition result is in the JSON format if one of the pages fails, and will consume quotas

Command Prototype

jsonRet = Mage.PDFOCRStamp(filepath,config,all_pg_state,page_cfg,sleepTime,time,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
filepathTruepath'''C:\Users'''The storage path of the PDF file to be recognized
configTrueexpression{}Call configuration of Laiye IDP
all_pg_stateTruebooleanTrueRecognize the specified page area in the PDF file; the default area is the entire page
page_cfgTrueexpression[[1,3]]Positive integer and array format are supported, for example, if users input 2, then the second page would be identified. If users input [1,3,5], the first, third, and fifth pages would be identified. If users input [1,[6,9],4], the first, fourth, sixth and nineth pages would be identified. When the "Recognize all pages" is set to "Yes", the value input to specify pages would be invalid. An error will be reported if the number of pages exceeds the total number of PDF pages, and each page will be identify only once
sleepTimeTruenumber10000The interval (in milliseconds) of each page in the PDF file is by default 10,000 milliseconds (10 seconds). The larger number of pages to be recognized and the short interval may lead to the exception of exceeded call frequencies
timeTruenumber30000Specify the waiting time in milliseconds. If exceeded, an exception will be thrown. Default: 30,000 milliseconds (30 seconds)
passwordNonestring""Only fill in when a PDF file password is needed

return

jsonRet,The variable used to save the output of the command.

Demo

Dim filepath=''''''  //  The path of the PDF file to be identified that contains the stamp image 
Dim config={"Pubkey":"","Secret":"","Url":""} // Get from mage

TracePrint "--------------------PDF Stamp Recognition--------------------"
// --------------------------------------------------------
// [Remarks] PDF stamp recognition
// Input parameter 1:
// filepath--The path of the PDF file to be identified that contains the stamp image
// Input parameter 2:
// config--mage configuration, need to configure Pubkey and Secret.Type:Dict
// Input parameter 3:
// all_pg_state--whether all pages are recognized
// Input parameter 4:
// page_cfg--Specify the page number area
// Input parameter 5:
// sleepTime--interval time. Default unit: milliseconds. Type: Int
// Input parameter 6:
// time--timeout time. Default unit: milliseconds. Type: Int
// Input reference 7:
// optionArgs--optional parameters (including: password).Type:Dict

// Output parameters:
// jsonRet--The variable to which the output of the function call is saved

// 命令原型:jsonRet = Mage.PDFOCRStamp(filepath,config,all_pg_state,page_cfg,sleepTime,time,optionArgs)
// --------------------------------------------------------

jsonRet = Mage.PDFOCRStamp(filepath,config,true,[1],10000,30000,{"password":""})