Skip to content

Page Limit for Technical Drawings

WERK24 helps protect its platform partners by setting default limits on the number of pages processed in multi-page documents containing technical drawings. This prevents the risk of excessive processing costs from documents with hundreds of pages. By default, WERK24 processes only the first page of each document.

However, you can adjust this limit using the max_pages parameter in the read_drawing function. Currently, WERK24 supports processing up to the first 5 pages of a document.

Each W24TechreadMessage includes the page_number attribute, allowing you to track which page is being processed.

How to Specify the max_pages Parameter

You can specify the number of pages to process by setting the max_pages parameter in the read_drawing function.

Specifying the max_pages

```python

from werk24 import Hook, W24AskPageThumbnail from werk24.models.techread import W24TechreadMessage from werk24.utils import w24_read_sync

define a function to read a file and return it as bytes

from . import get_drawing_bytes

def recv_thumbnail(message: W24TechreadMessage) -> None: """ Store the Thumbnail locally """ if not message.is_successful: return

page_number = message.page_number
with open(f"page_thumbnail-{page_number}.png", "wb+") as fid:
    fid.write(message.payload_bytes)

if name == "main":

# get your drawing bytes from a file or buffer
drawing_bytes = get_drawing_bytes()

# define what information you want to receive from the API
# and what shall be done when the info is available.
hooks = [Hook(ask=W24AskPageThumbnail(), function=recv_thumbnail)]

# submit the request to the Werk24 API
w24_read_sync(drawing_bytes, hooks, max_pages=5)

```