ForHosting KIT · Documents & PDF

Remove blank PDF pages and count the pages left

Remove blank PDF pages from a document workflow without guessing which page numbers should disappear.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

Supply one record for every PDF page, in order, and indicate whether that page contains text or images. The capability treats a page as blank only when both signals are absent, returns the one-based numbers of every blank page, and calculates how many pages remain after removal. It is useful after scanning, assembling, or exporting documents when another step has already detected page content.

Describe every page in its original order

Start with the PDF page inventory produced by your parser, scanner, or document processing pipeline. Send a pages array containing one record per page, preserving the exact document order. Each record needs two Boolean values: has_text says whether text is present, and has_images says whether an image is present. These values must be true or false, not strings such as “yes” or numbers such as 1. The array position determines the page number, so the first record represents page 1, the second represents page 2, and so on. Include every page, even when it is blank, because leaving out a record would shift all later page numbers. The input describes content presence rather than uploading or modifying PDF bytes. That makes the result easy to integrate when your existing PDF library has already inspected pages and only needs a reliable decision about which page indexes to remove.

Understand exactly what counts as blank

A page is classified as blank only when has_text is false and has_images is also false. Text without images keeps the page, and an image without text keeps it as well. This conservative rule avoids deleting scanned pages, signatures, diagrams, photographs, or other image-only content. It also avoids deleting a text-only cover, separator, or form page. The capability does not inspect visual whitespace, OCR confidence, tiny marks, annotations, vector paths, or PDF drawing commands; the flags supplied by your upstream detector are the complete source of truth. The response lists blank pages using familiar one-based numbering and reports the original page count, number removed, and remaining page count. Blank pages are listed in ascending document order. If every page is blank, the remaining count is zero. If no pages are blank, the blank list is empty and the remaining count equals the original count. An empty page array is rejected because it cannot represent a PDF with pages.

Apply the result safely to a PDF workflow

Use blank_pages as the deletion plan for the PDF tool that owns the actual document bytes. Many PDF libraries change later indexes whenever a page is removed, so either delete the returned page numbers in descending order or use a library operation that accepts the complete original page selection at once. Check remaining_page_count before writing the result if your application should refuse to create a zero-page document. Keeping the original and removed counts beside the output is also helpful for logs, previews, and approval screens: an operator can see that a twelve-page scan will become ten pages before any file is changed. Because the algorithm uses only the provided Boolean flags, repeated calls with the same input always return the same answer. No network request, content upload, OCR process, or hidden blankness threshold is involved. For automated API calls, the declared base price is $0.002; the browser version can run the same deterministic calculation locally.

Clean scanned document batches

Turn scanner-produced text and image presence flags into a page deletion list before archiving each PDF.

Remove export separator pages

Identify empty pages introduced while combining reports and calculate the final page count before delivery.

Preview document cleanup

Show users which page numbers would be removed and how many pages would remain before changing a file.

What does it cost?

An API request costs $0.002. The same deterministic calculation is also available in the browser.

When is a page considered blank?

Only when both has_text and has_images are false. If either flag is true, the page is retained.

Are returned page numbers zero-based?

No. Page numbers are one-based, so the first input record is page 1.

Does this capability edit or return a PDF file?

No. It returns a deletion plan and counts from supplied presence flags; your PDF library applies the removals.

What happens if every page is blank?

Every page number is listed and remaining_page_count is zero. Your application can then decide whether to permit an empty result.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/pdf/remove-blank-pages

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/pdf/remove-blank-pages \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pages":[{"has_text":true,"has_images":false},{"has_text":false,"has_images":false},{"has_text":false,"has_images":true}]}'
{
  "pages": [
    {
      "has_text": true,
      "has_images": false
    },
    {
      "has_text": false,
      "has_images": false
    },
    {
      "has_text": false,
      "has_images": true
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "pdf.remove_blank_pages",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb25
max_pages200
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →