Free plan

PDF layers

See the layers inside a PDF and switch them on or off
POST
/v1/pdfs/layers

About this tool

Some PDFs, such as maps, plans and drawings, are built from layers, a bit like transparent sheets stacked on top of each other. This tool lists the layers of your PDF and shows which are on. You can also switch layers on or off by name, for example to hide the dimensions on a drawing. A PDF without layers has nothing to switch.
For example, you have a floor plan PDF and want to hide the layer called Furniture before sending it to the builder.

How to use it

  1. Choose this tool.
  2. Add your PDF (one file).
  3. Choose whether you only want to list the layers or to switch some on or off.
  4. To switch layers, type the names of the layers to show and the layers to hide, or choose show all or hide all.
  5. Press Generate, then download the result or read the list.

What you get back

With the list option you see every layer and whether it is on or off. With the switch option you get a new PDF with your chosen layers on or off, ready to download.
GOOD TO KNOW
Sets the default visibility stored in the file; a viewer lets the reader switch layers again. A PDF with no layers is refused for set. Counts as one PDF operation.
TEST IT LIVE

Try PDF layers in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/layers
Tool ID
pdfs.layers
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/layers" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'operation=list' \
  -F 'show=["Labels"]' \
  -F 'hide=["Cut line"]'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.layers({
    "file": 'document.pdf',
    "operation": "list",
    "show": "[\"Labels\"]",
    "hide": "[\"Cut line\"]"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->layers([
    'file' => 'document.pdf',
    'operation' => 'list',
    'show' => '["Labels"]',
    'hide' => '["Cut line"]',
]);
echo $result->requestId;
FAQ

Frequently asked questions

List the layers (optional content groups) of a PDF with their on/off state, or switch layers on and off by name: a map without its labels, a drawing without its dimensions, a print without its cut line.

PDF layers accepts PDF. You can send several files in one request.

PDF layers is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/pdfs/layers with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.