Step by step guide:

1. In this tutorial, we will show you how you can extract font, font style, font size, text color, and text position from a PDF file. We will use this sample Invoice PDF as our source file.

Sample PDF

Screenshot of Source PDF

2. Let’s jump straight to Step 2 and set up PDF.co. Kindly choose PDF.co as the App and PDF to Anything Converter as the Action Event. The PDF to Anything Converter converts PDF to JPG, PNG, CSV, XML, JSON, and other formats.

Setup PDF.co

3. Next, let’s configure the PDF to Anything Converter.

  • In the Output Format field, select the JSON(text objects and forms)
  • In the PDF URL field, enter your PDF source file. In our case, we entered the sample Invoice PDF URL.
  • In the Name field, enter your desired output file name.
  • In the Inline Output field, choose False. Setting the Inline to False will return a URL where we can download the JSON file. Setting it to True will return the JSON inside the response instead of a downloadable file.

Setup Action

Setup Action

4. Now it’s time to Test & Review our data and send PDF to Anything to PDF.co.

Test & Review

5. Our test was a success! Kindly copy the URL link and paste it on your browser’s address bar to download the resulting JSON file.

Test Result

6. Hurray! We have successfully converted the sample Invoice PDF file to JSON.

JSON Output
Screenshot of the JSON file

{
  "document": {
    "page": {
      "@index": "0",
      "row": [
        {
          "column": [
            {
              "text": {
                "@fontName": "Arial",
                "@fontSize": "24.0",
                "@fontStyle": "Bold",
                "@color": "#538DD3",
                "@x": "36.00",
                "@y": "34.44",
                "@width": "242.81",
                "@height": "24.00",
                "#text": "Your Company Name"
              }

7. If you’ll take a closer look at the JSON result, you will see that the text Your Company Name has an Arial font name, a 24 font size, a Bold font style, a #538DD3 color, a 36 x and 34.44 y coordinates, a 242.81 width, and a 24 height.

Related Pages: