Skip to main content

How to add profile to PDF.co request

How to add profile to PDF.co request

IMPORTANT: for every KB product sections, there is Profiles article. Check this article to find sample profiles for that specific endpoint or a product. To see all KB product sections, click here

Profiles are specific to the endpoint you call. For Zapier's Custom Profiles field or Make's Profiles field, enter a JSON object. For direct API requests, the profiles value must be a JSON-encoded string, not a nested object. In code, serialize the profile object first and then include that string in your request payload.

Zapier

You can add the profiles parameter in the Custom Profiles field.

To add a single profiles param property, you can use the format below:

{
  "zipExcludeFilter": "*.doc*,*.xls*"
}

To add multiple profiles param properties, you can separate them using a comma.

{
  "GenerateBookmarks": true,
  "BookmarkTitles": [
    "BookmarkName1",
    "BookmarkName2",
    "BookmarkName3"
  ]
}

Make (Integromat)

The step is the same as in Zapier except you will add the profiles param in the Profiles field.

To add a single profiles param property, you can use the format below:

{
  "zipExcludeFilter": "*.doc*,*.xls*"
}

To add multiple profiles param properties, you can separate them using a comma.

{
  "GenerateBookmarks": true,
  "BookmarkTitles": [
    "BookmarkName1",
    "BookmarkName2",
    "BookmarkName3"
  ]
}

Postman

You can add the profiles param in your Postman JSON code. For multiple properties, you can separate them with comma.

{
  "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-to-json/sample.pdf",
  "inline": true,
  "profiles": "{\"DetectNewColumnBySpacesRatio\":\"2.0\",\"OCRMode\":\"TextFromImagesAndFonts\"}"
}

Python

You can assign the profiles param values to a variable. To see some of the advanced options, check out this sample code

import json
profiles = json.dumps({
    "TrimSpaces": False,
    "PreserveFormattingOnTextExtraction": True
})

C#

You can add your profiles param in a JSON file and call the JSON file in your program. To see it in action, check out our sample code here

Sample profiles parameter in a JSON request file

{
  "profiles": "{\"TrimSpaces\":false,\"PreserveFormattingOnTextExtraction\":true}"
}

Java

You can assign the profiles param to a variable. For multiple profiles param properties, you can separate them with comma. We have a sample code with advanced conversion option here

String profiles = "{\"TrimSpaces\":false,\"PreserveFormattingOnTextExtraction\":true}";

JavaScript

You can assign the profiles param to a const variable. For multiple profiles param properties, you can separate them with comma. We have a sample code with advanced conversion option here

const profiles = JSON.stringify({
  TrimSpaces: false,
  PreserveFormattingOnTextExtraction: true
});

PowerShell

You can assign the profiles param to a variable. For multiple profiles param properties, you can separate them with comma. We have a sample code with advanced conversion option here

$Profiles = '{"TrimSpaces":false,"PreserveFormattingOnTextExtraction":true}'

VB.net

You can add your profiles param in a JSON file and call the JSON file in your program. To see it in action, check out our sample code here

Sample profiles parameter in a JSON request file

{
  "profiles": "{\"TrimSpaces\":false,\"PreserveFormattingOnTextExtraction\":true}"
}

cURL

For Bash or a similar POSIX shell, pass the JSON request using --data-raw. Replace YOUR_API_KEY with your API key:

curl --request POST 'https://api.pdf.co/v1/pdf/convert/to/json' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-to-json/sample.pdf",
  "inline": true,
  "profiles": "{\"DetectNewColumnBySpacesRatio\":\"2.0\",\"OCRMode\":\"TextFromImagesAndFonts\"}"
}'
Did this answer your question?