Available Now: Explore our latest release with enhanced accessibility and powerful IDP features

Peeling Back the Layers: A Comparison of PDF Tools – Part 1

By Roger Dunham | 2024 Mar 06

Sanity Image
Read time

8 min

Introduction

Copied to clipboard

PDF layers, also known as Optional Content Groups (OCGs), are a great addition to PDF functionality and have been around for almost 20 years. When used in conjunction with a PDF viewer, layers allow for the creation of customizable views within PDF documents.They allow content to be broken into separate parts so the user is able to view just a subset of those parts. This can be extremely useful with CAD drawings, for example, since it allows the user to focus on those aspects of the drawing that they are interested in, without being distracted by things that are not currently important.

But not all PDF viewers work in the same way, and PDF layer support is patchy, to say the least.

In this article we will look at how a range of PDF readers handle a PDF that contains layers, and how the Apryse WebViewer is a standout solution.

In the next article in this series, we will look at nested layers and the handling of layers in multipage documents. The third article will cover multipage nested layers. Then, we'll look at how to create a single PDF from each layer.

Sample PDFs

Copied to clipboard

Hidden and Locked Layers

For this article, a PDF has been created that has five layers, each of which relates to a functionality layer within an architectural CAD drawing.

Two of the layers are shown by default, and three hidden. One of the visible layers, HVAC, has been locked, so that the user cannot hide it, and one of the hidden layers, Electrical, has been locked so that the user cannot show it. The intention is that the user can choose which other layers to show or hide.

The data is similar to, but slightly different from, that used in the Apryse CAD support showcase demo.

If that seems a bit confusing, it will all become clear when we start to look at the data. Each of the layers is a different color – so for example, if we are looking at just the Architecture (brown), and the HVAC (pink), we will see something like this:

Blog image

Figure 1 – The test PDF with just two layers visible

However, if the Pipework (green and blue) and Equipment (gray) are also enabled, the same PDF will look different, and potentially rather cluttered.

Blog image

Figure 2 – The same PDF with more layers enabled. The Electrical layer is locked, so the user cannot make it visible.

As we look at a range of PDF Viewers, we will see that not all of them behave the same way.

PDF Viewers Tested

The following browsers were tested:

  • Chrome – 121.0.6167.185
  • Firefox – 122.0.1
  • Edge – 121.0.2277.128

Seven within-browser (Chrome) options were reviewed:

Two standalone desktop tools were reviewed:

  • Adobe Acrobat – 2023.008.20533
  • PDF Studio Pro – 2023.0.4

Which is the Best PDF Viewer?

Copied to clipboard

The following were assessed to test how well a PDF viewer works with layers:

  1. Are just the specified layers visible when the PDF is first shown?
  2. Is it possible to hide/show a layer that is unlocked?
  3. Are locked layers correctly supported so that the user cannot change their visibility?
  4. Is the UI intuitive?

Are Just the Specified Layers Visible When the PDF is First Shown?

Copied to clipboard

The sample file contains a mix of visible and hidden layers. Only the visible ones should be shown when the PDF is first displayed. A good result would consist of just those layers being visible.

Blog image

Figure 3 – A correct result when verifying that only the layers specified as visible are shown

A bad result, on the other hand, is when different layers are visible when the PDF is opened – either layers that should be hidden are shown, or ones that should be visible are hidden.

Blog image

Figure 4 – An incorrect result with all the layers visible. This occurs with PDF.JS Express, PDFSimpli and Allinpdf.

Is it Possible to Hide/Show a Layer That is Unlocked?

Copied to clipboard

Irrespective of what layers are shown when the PDF opens, is it possible to show or hide specific layers?

Since some of the layers are locked within the PDF, it should not be possible to toggle either HVAC or Electrical layers, but we will look at those in the next section.

Blog image

Figure 5 – Some viewers like Apryse WebViewer allow you to see which layers are visible and to work with them.

Some simple viewers don’t have any method for working with layers. Chrome, for example, displays the default layers, but it is not possible to see or hide specific layers.

Blog image

Figure 6 – Some viewers like Chrome do not allow the user to work with layers.

Are Locked Layers Correctly Supported, so That the User Cannot Change their Visibility?

Copied to clipboard

The PDF was deliberately created to have some layers that were locked so that the visibility cannot be changed. The Electrical layer should never be visible, and the HVAC layer should always be visible.

With some of the tools it is obvious that this is the case, and testing confirms this.

Blog image

Figure 7 – Apryse WebViewer makes it clear that some layers are locked, and this is correctly enforced. 

Some other tools, however, allow the user to toggle layers, even though they are specified as being locked.

Blog image

Figure 8 – PSPDFKit allows users to enable or disable any layer, even ones where this should not be possible. In this case, the Electrical layer (blue) has been incorrectly enabled.

Is the UI Intuitive?

Copied to clipboard

This is, of course, a subjective question. The test here is whether it is clear which layers are visible, which are hidden, and which are locked.

The layers panel in WebViewer (which is also used within Xodo.com) makes it clear which layers are locked, which can be toggled, and at the same time makes it obvious which layers are visible and which are not.

Blog image

Figure 9 – The WebViewer UI clearly shows whether layers are locked and whether they are visible.

The panel in Qoppa PDF Studio Pro uses gray text to show that a layer is locked. However, locked layers that are visible are still marked as hidden, so although the functionality is correct, the UI is confusing.

Blog image

Figure 10 – In PDF Studio Pro, the HVAC layer, although locked, is actually visible, but the UI suggests that it is hidden.

PSPDFKit appears to follow the idea that gray text means that the layer is locked. However, in PSPDFKit, gray text actually means that the layer is hidden.

In fact, layer locking, as specified within the PDF, is not correctly supported.

In addition, the UI is confusing – it is possible to “lock” a layer within the UI, but that appears only to prevent inadvertent toggling of visibility for the layer.

Blog image

Figure 11 – The UI in PSPDFKit is confusing. Gray text suggests that options are disabled, but they are not. And the lock suggests that the layer is locked. While it is, that is a UI lock, not one specified from the PDF.

Adobe Acrobat Reader usually has a great UI, but in this case it is confusing. The check box that indicates layer visibility by displaying an eye has been reused to also show whether the layer is locked.

As such, it is not possible, without hovering a mouse over the checkbox, to tell whether a locked layer is or is not visible. At some point, that confusion could result in a lot of wasted time.

Blog image

Figure 12 – The Adobe Acrobat Reader UI shows that Electrical and HVAC layers are locked, but there is nothing obvious to indicate that HVAC is visible, while Electrical is not.

Unlock the Best Viewing Experience - Discover How Apryse Tools Can Seamlessly Convert PDFs to HTML

Summary

The following table summarizes the test results. If layers matter to you, you’ll want to choose a PDF viewer that has as many green cells as possible.

Blog image

Conclusion

Copied to clipboard

PDF Layers can make complex PDFs simpler to understand, but only if the correct PDF viewer is used. With some viewers, the user may see information that the creator did not intend them to see, while also being unable to delve into the layers of information in the way that was intended.

While Firefox supports layers in a rudimentary way, the other browsers have very limited built-in support.

In-browser and desktop tools, like Apryse WebViewer and PDF Studio Pro, offer much greater support. But even with such tools, not all are equal. Some, like PSPDFKit, have confusing UIs or do not correctly support locked layers.

Apryse WebViewer, however, stands out as a powerful, highly functional product that is easy to add to your own apps.

But don’t just take our word for it, try out the functionality at the Apryse showcase and then have a look at the many samples that illustrate how to get started.

Alternatively, you can try out the SaaS option at Xodo.com.

When you are ready to get started, see the documentation for the SDK to get going quickly. Don’t forget, you can also reach out to us on Discord if you have any issues.

Sanity Image

Roger Dunham

Share this post

email
linkedIn
twitter