Resize & Compress PDF – PDF Editing Via API

Image by

PDF editing with the API –it can do more than “just” convert!

With our API you can easily edit PDFs with regard to various sizes. File size can be changed just as well as the paper size of a PDF document. In this article, we will show you how you can do so using an API execution app named postman. The functions we will look at are the following:

  • Compress PDF: Change the file size of a PDF
  • Resize PDF: Change the paper size of a PDF

If you are interested in other PDF editing tutorials with our API, check out the list at the end of this article.


Resize & Compress PDFs With Our API

The basis to this tutorial is a general knowledge of postman and access to our API. If you are not familiar with the app or can’t access our API, check out this tutorial on how to use the API with postman. The tutorial provides a step-by-step guide on how to set up postman using our collection file, which is of course linked.

If you prefer video tutorials, check out how to use the API on YouTube.


After you are familiar with the basics, we can dive into the topic of changing file and paper sizes of PDF documents. The following command is essential for the editing. This simple POST command converts a remote file, here a PDF document, into another PDF file.

    "input": [{
         "type": "remote",
         "source": ""
     "conversion": [{
     "target": "pdf",
     "category": "document"

To add the editing function to the command above, the following addition will be needed:

"options": {


Compress PDF Documents

PDF compression and thus reduction or changing of the file size is done by adjusting the quality settings of a PDF document. Thus, the following schema that is used by postman to apply the changes to an uploaded document is named “quality” instead of “compression”:

"quality": {
    "type": "string",
    "description": "Optimizes the output for a specific target which will produce different output file sizes. It may override other quality options.",
    "enum": [

For changes in a PDF’s quality – and thus it’s file size – there are several presets available. The value of the “quality” option has therefore to be a string containing one of the presets. Lets have a look at what these presets do (ignoring the “default” string for now):

  • Screen: screen quality, 72 dpi images
  • eBook: low quality, 150 dpi images
  • Printer: high quality, 300 dpi images
  • Prepress: high quality, color preserving, 300 dpi images


A full command to compress a PDF file should look like this:

    "input": [{
        "type": "remote",
        "source": ""
    "conversion": [{
        "target": "pdf",
        "category": "document",
        "options": {
            "quality": "ebook"

With this API call, the quality of the converted file will adapt the preset of ebook. In our example, this reduced the file size of the PDF from 1.04 MB to 247 KB.



Change a PDFs Paper Size

In order to change the paper size of a PDF, the following scheme is used:

"page_size": {
    "type": "string",
    "description": "The size of the pages",
    "enum": [

The page size option takes a string of characters as a value. The possible strings are listed above and represent common paper sizes. Since some of the labels may be confusing, here’s a full list ordered by the standard:

  • ISO A: A0, A1, A2, A3, A4, A4 small, A5, A6, A7, A8, A9, A10
  • ISO B: B0, B1, B2, B3, B4, B5, B6
  • ISO C: C0, C1, C2, C3, C4, C5, C6
  • JIS B: B0, B1, B2, B3, B4, B5, B6
  • ARCH: ArchA, ArchB, ArchC, ArchD, ArchE
  • Other: Ledger, Legal, Letter, Half Letter, Letter Small, Hagaki, FLSA, FLSE, 11×17


A complete POST command to change the paper size of a PDF should thus look like this:

    "input": [{
        "type": "remote",
        "source": ""
    "conversion": [{
        "target": "pdf",
        "category": "document",
        "options": {
            "page_size": "a2"

This call increases the paper size from our regular, A4 PDF to a page size of A2.


Got any questions?

If you still have questions about how to use’s API to edit your PDFs, drop us a message. A friendly and competent support team will make sure that you will be able to do your conversions just like you wanted to.


Further Information