The Apryse Summer 2026 Release: OUT NOW

Home

All Blogs

Using CoPilot to create a tool to extract tables from PDFs

Published July 24, 2026

Updated July 24, 2026

Read time

5 min

email
linkedIn
twitter
link

Using CoPilot to create a tool to extract tables from PDFs

Sanity Image

Roger Dunham

Summary: Learn how to build a PDF table extraction tool using GitHub Copilot and the Apryse SDK in Node.js. This comparison tests open source libraries against Apryse's Smart Data Extraction module, showing real results from actual PDFs. You'll learn how to extract structured tabular data, convert PDF content to JSON and markdown, and why SDK choice matters for accuracy, data privacy, and cost at scale.

Sanity Image

So, here’s the problem.

You have thousands of PDFs that contain tabular data, and you want to extract that data so that you can use it for subsequent processing.

There are lots of ways that you could do that.

At one extreme, you could do it manually, but it’s a long and tedious, and therefore error-prone, task

Alternatively, you could upload each PDF to ChatGPT and get it to extract the tables. AI might do a great job of that, depending on what the table structure is like.

Blog image

Figure 1 - The result of uploading a PDF via Copilot and asking it to extract the tables.

Even if the results are great, there are two problems with using a cloud-based AI:

  • You lose control of your data, once it is sent to a remote server, you can’t guarantee that private data will remain private.
  • OpenAI needs an API key, and consumes tokens, and that could get very expensive as your business scales.

In this article we will look at how we can use AI (in this case GitHub Copilot running in Visual Studio Code) to create a tool that will extract that data for us, while processing the PDFs on your machine, rather than sending them over the internet.

TL;DR: The Apryse SDK and Smart Data Extraction gives a great result.

Sample PDF

Copied to clipboard

There are billions of files you could use to test the process, and you should try this out with your own ones.

However, for this article I’m using one taken from the corpus of PDFs that have been used for benchmarking PDF processing software.

(There is nothing special about the file; it was just the first one that I found in the corpus that contained at least one table).

The specific file that I’m using is called 01030000000190.pdf. You can download it from a couple of different locations: Github and here.

It’s a file that is typical of many others, with a mixture of tables and non-tabular text on the same page. In particular, it has TWO tables.

Blog image

Figure 2 - Part of the sample document - you can see that there are two tables present.

Let’s look at two different approaches to creating a Node.js based tool that can process the PDF and show the data extracted from the tables within it. One uses an Open Source solution, the other the commercial Apryse SDK

An Open Source solution

Copied to clipboard

I scaffolded an empty app using npminit , and then within VS Code, I asked GitHub Copilot to “build me an extraction workflow usingapryse sdk ”.

It wanted a little more information about whether I wanted the processing to be client-side, or server-side, and exactly what I needed to extract. I clarified that I wanted it server-side, and that I was interested in tables only.

It led me through a number of steps, with enormousconfidence , over the next five minutes, and ultimately created an app.

Blog image

Figure 3 - The output of the Chat with GitHub Copilot

Copilot even scaffolded documentation and a test (which ran successfully), and finally told me to use npm run extract [filename].pdf. 

That sounded like a great result – a working app with almost no effort on my behalf.

However, when I inspected the code, I found that, despite explicitly telling Copilot to use the Apryse SDK, it had instead decided to use open-source tools such as pdf-parse.

Blog image

Figure 4 - Copilot made the unilateral decision to ignore my instructions to build the tool using the Apryse SDK.

Nonetheless, it seemed worth testing. The code ran without error and returned three CSV files, each containing a table that had been detected.

Blog image

Figure 5 - The code ran and detected three tables in the PDF.

Hang on! The PDF only has two tables, but our new Open-source based tool found three. That’s not ideal.

It gets worse.

If we investigate what was in the recovered tables, we find that they were not tables at all, and just seemingly random parts of the text, and the actual tables had not been detected.

Blog image

Figure 6 - The Open-source tools entirely missed the real tables and detected three phantom ones.

If we were to give that a score, then Copilot with Open-source tools would get zero points. And that’s if we were generous.

Full of confidence. Entirely lacking in usefulness.

I guess that we got something proportional to what we paid for it. Free is definitely not always best.

A Commercial Solution with the Apryse SDK

Copied to clipboard

Once again, the project was scaffolded using npminit , and then Copilot Chat Window was given the prompt “build me an extraction workflow using apryse sdk”.

This time, Copilot followed my instructions and used the Apryse SDK. It correctly identified that it would need both the Apryse SDK and the add-on Data Extraction module (both of which are available via npm).

Copilot found it hard to find the Apryse libraries – largely because Apryse was formally known as PDFTron and that was causing confusion. Nonetheless, Copilot resolved that by itself.

Blog image

Figure 7 - Part of the Copilot output when creating a tool based on the Apryse SDK

After a few minutes, the tool was complete, along with instructions that described how to use it.

Blog image

Figure 8 - Some of the Copilot output describing how to use the tool.

Copilot even created README.md file that informed me that I needed to add an Apryse License key to my environment, before running the tool.

Blog image

Figure 9 - Before running the tool, I needed to add a license key as an environment variable.

After a few moments, a JSON file was created that contains ALL of the content from the PDF, including the location and font properties of each element.

Blog image

Figure 10 - The default output from the tool was a JSON file that contained detailed information about the structure and contents of the PDF.

If I wanted, I could use that JSON directly and feed it into another process such as a RAG.

For this article, I wanted to be able to visualize the data. That is hard with JSON, so I asked Copilot to create a script that would parse the JSON, extract just the table elements and create markdown for the tables, discarding all of the other information that was included in the JSON.

Blog image

Figure 11 - The final result of the tool - Markdown that contains all of the tabular data, and no other data.

The result was superb! We have all the data from the two tables in the PDF, and nothing else.

Markdown generation directly from Smart Data Extraction is on our roadmap for later this year. Stay tuned!

A real benefit of extraction to JSON (rather than markdown), is that a lot of other data is captured, which might otherwise have been discarded when going to markdown. For example, we could modify the post-processing and find which text was bold, or italic, or even a specific font face.

Blog image

Figure 12 - The JSON contains information that allows richer processing, such as finding which text was bold.

That offers a way to access a whole extra dimension of data.

What about other files?

Copied to clipboard

A sample size of 1 doesn’t mean much, so I ran several other files from the same corpus through the new tool. In each case, the tabular data was extracted correctly.

Blog image

Figure 13 - The output from processing file 01030000000127.pdf - another great result.

Blog image

Figure 14 - The output from 01030000000149.pdf

Blog image

Figure 15 - The Apryse Showcase - demonstrating how you can get many types of data from Structure Data Extraction

Wrapping up

Copied to clipboard

What a great result from Apryse. With very little effort, we have used GitHub Copilot, VS Code and the Apryse SDK to create a tool that can extract tabular data from a PDF and create JSON, and with a little extra code we can create markdown for the tables that are found.

On the other hand, when Copilot chose to use an Open-source tool, the result was very poor. If you are a great developer with lots of time and patience, then you might be able to work with those Open-source tools and ultimately get good results.

However, if time to market is critical, and you want a library backed up by support engineers then look no further than the Apryse SDK.

Better still, while our tool currently extracts tabular data, we could change the way that we are parsing the JSON and extract footers, or italic text, or images – Apryse offers the ability to pivot if the requirements change as they so often do.

If you have any questions, you can reach out to us on Support channel.

If you have any questions about this blog, or there are other blogs that you would like us to write, then please contact us at blog-feedback@apryse.com.

Ready to get started?

Sign up for a free trial to begin implementing the Apryse SDK in your application!