← All procedures

ocr.pageCount

Give the number of pages of a PDF file (pdfinfo), so a caller can read each page with ocr.page

CLI
Package
@procedures/ocr · README
Path
["ocr","pageCount"]
CLI
mark ocr pageCount --file <string>
As data
{"$proc":["ocr","pageCount"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/ocr/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["ocr","pageCount"], { file: "<file>" });
console.log(JSON.stringify(result));

From the command line

$ mark ocr pageCount --file <string>

As data, in a program

{ "$proc": ["ocr", "pageCount"], "input": { "file": "<file>" } }

Input

FieldTypeRequiredDefaultDescription
filestringyesThe path of the PDF file
timeoutintegernoThe time limit of each program, in milliseconds (default: 120000)

Output

FieldTypeRequiredDefaultDescription
pagesintegeryesThe number of pages of the file. The pages of ocr.page are the numbers from 1 to this number
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "file": {
        "type": "string",
        "minLength": 1,
        "description": "The path of the PDF file"
      },
      "timeout": {
        "description": "The time limit of each program, in milliseconds (default: 120000)",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991
      }
    },
    "required": [
      "file"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "pages": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991,
        "description": "The number of pages of the file. The pages of ocr.page are the numbers from 1 to this number"
      }
    },
    "required": [
      "pages"
    ],
    "additionalProperties": false
  }
}