Prerequisites
- A Meibel API key. Set it as an environment variable so the examples can read it.
- One of the Meibel SDKs installed, or
curlfor the raw HTTP examples. - A PDF to parse. The first step downloads a sample; any PDF of your own works too, and a report or an invoice with a table in it shows off the structure best.
1. Get the sample document
This tutorial works on a public jobs report from the U.S. Bureau of Labor Statistics. It is a good document to parse because it mixes the structure parsing recovers: a title and section headings, a summary table, and a couple of charts. Download the copy Meibel hosts for this tutorial.2. Submit the document
Parsing runs as a job so your program stays responsive while a large file is processed. Submitting a file returns a job ID right away, before the work finishes. You hold onto that ID to check progress and collect the result.job_id and an initial status of queued. The job ID is the handle for everything that follows, so store it.
3. Wait for it to finish
A successful job moves through three statuses:queued, then processing, then completed. Polling the status endpoint tells you where it is, and once it reaches completed the status also reports what parsing found: the page count, how many elements and tables were extracted, and an overall confidence score. Those numbers are a quick sanity check before you read the full result.
A 2-second polling interval works well for most documents. Larger files take longer, so the loop simply runs a few more times.
4. Read the result as Markdown
With the job complete, you can fetch the result. Markdown is the format to start with: it is the document as readable text, with headings kept as headings, lists as lists, and tables rendered as Markdown tables. This is what you would hand to a language model or drop into a page for a person to read.5. Read the same result as structured data
Markdown is for reading. When your code needs to act on the content, fetch the strongly-typed structured result instead. It comes back organized by page, each holding its elements in reading order, and every element is a typed object with alabel, its text, a bbox giving its position, a reading_order, and a confidence score. A Title or SectionHeader carries a heading_level, and a Table carries a grid of cells you can address by row and column.
What you learned
You submitted a document, waited for the job, and read a single parse back as both Markdown and structured data. That same flow, submit then poll then fetch, handles any supported input: a digital PDF, a scan, or an office document all return the same structured content, whether you parse one file or run many through these steps. From here:Choosing an output format
When Markdown, the structured result, or annotated output fits your task.
Extracting tables
Turn the table cells you saw here into rows your code can use.
How parsing works
Understand the stages behind the result you just read.
Output schema
The full field list for the structured result you just printed.