Unlock the Power of Direct PDF Editing with WebViewer 10.7

Multipage Nested Layers: A Comparison of PDF Tools – Part 3

By Roger Dunham | 2024 Mar 13

Sanity Image
Read time

8 min

Introduction

Copied to clipboard

PDF layers, also known as optional content groups (OCGs), are a part of PDF functionality and have been around for almost 20 years. This can be extremely useful with CAD drawings, for example, allowing users to focus on those aspects of the drawing that they are particularly interested in, without being distracted by things that are not currently important.

In the previous articles in this series, we looked at how simple layers and nested layers were supported in a range of PDF viewers.

In this article, we will look at the support for multipage PDFs that contain nested layers (layer groups) in a range of PDF readers, and see why the Apryse WebViewer is a standout solution.

Sample PDF

Copied to clipboard

In the second article in this series, the sample PDF was created using ArcGIS from ESRI and contains mapping data for parts of the Western USA. That PDF, and two more for other parts of the US created in the same way, have been merged into a single three-page document (using xodo.com).

The resulting document is similar in format and data complexity to files that some customers work with. It contains three pages – each with a set of layers that relate to a single page.

As before, the Scale Bar is a great example of a layer group, consisting of the ratio text, and two scale lines – one for miles and the other for kilometers.

Blog image

Figure 1 – The Scale Bar with all layers visible

This allows any of those items to be hidden either separately or as a group.

Blog image

Figure 2 – The same PDF with all of the nested layers that comprise the scale bar hidden

In the previous article, we saw that Chrome, Edge, PDF.js Express, Aspose, PDFSimpli, and Allinpdf do not support layers, so we will not look at them again. As such, the tools used in this test are those that successfully worked with simple layers.

PDF Viewers Tested

Copied to clipboard

The following browser was evaluated:

  • Firefox – 122.0.1

Three within-browser (Chrome) options were reviewed:

  • Xodo online – Using Apryse WebViewer 10.5.1
  • Locally hosted React app containing Apryse WebViewer 10.7.1
  • PSPDFKit sample page – PSPDFKit for Web 2024.1.2

Two standalone desktop tools were reviewed:

  • Adobe Acrobat – 2023.008.20533
  • PDF Studio Pro – 2023.0.4

Which PDF Viewer is Best for Multipage PDFs with Nested Layers?

Copied to clipboard

The following features were used to assess how well a viewer works with multipage PDFs that contain layers:

  1. What happens if only a single page is visible – are layers shown for just the visible page?
  2. If multiple pages are shown, are all of the relevant layers shown?
  3. When pages are removed from the PDF, are the layers that relate to those pages removed?

Which Viewer is the Most Intuitive?

Copied to clipboard

Acrobat sets the standard here. If a single page is visible (within the view), just the layers that relate to that page are available in the Layers Panel.

Blog image

Figure 3 – Acrobat showing the layers for just one page in Single-Page View

With Two-Page View (without scrolling), the layers for both pages are shown.

Blog image

Figure 4 – Acrobat showing the layers for both pages when Two-Page View is used

Similarly, if all three pages are visible, the layers for all pages are shown.

Blog image

Figure 5 – Acrobat showing the layers for all three pages, which is needed because Two-Page View with scrolling is used for the display.

For this PDF and ones like it, the ability to hide unused layers is helpful. Each page has the same layer names, so it can be confusing as to which layer relates to which page.

With all of the pages visible, if the last Scale Bar is hidden from the Layers panel, then the scale bar disappears for that page exactly as expected.

Blog image

Figure 6 – Acrobat showing how the layers can still be used to hide content on a specific page

Let’s look at the other viewers.

Firefox

Firefox behaves entirely differently from Acrobat. In previous articles we have seen that Firefox has issues with showing nested layers. But now the number of layers becomes completely unwieldy, and it is possible to “hide” layers that are not actually visible.

Blog image

Figure 7 – Firefox shows so many layers that it is hard to work out what is going on. It is easy to hide a layer related to a page that’s not visible, leading to wasted time.

Apryse WebViewer and Xodo

Apryse WebViewer shows all of the layers even if only a single page is showing. As a result, it is possible to “hide” layers that are not actually visible, which has the potential to be very confusing.

Blog image

Figure 8 – Apryse WebViewer Layers Panel shows layers related to pages that are off screen. The two Scale Bars have been hidden, but as those layers relate to pages that are offscreen, the scale bar on page 1 is still visible.

PSPDFKit

It was difficult to evaluate PSPDFKit. The online demo either allows you to set the view to single page/two page etc., or to show layers. Although all of the layers were visible, it is not possible to rule out that if only a single page was shown, only the layers relating to that page would be visible in the Layers Panel.

Blog image

Figure 9 – In PSPDFKit, all of the layers are shown in the Layers Panel (and it is unclear how to set the UI to just show a single page).

However, as previously found, any attempt to toggle layer visibility results in all of the map content being hidden.

Blog image

Figure 10 – With PSPDFKit, toggling the Scale Bar results in the entire map disappearing.

PDF Studio Pro

As previously reported, PDF Studio Pro does not support nested layers well.

Furthermore, in a multipage document, its Layer Panel shows all of the layers for all of the pages, making it difficult to use.

Blog image

Figure 11 – PDF Studio Pro shows all of the layers for all of the pages within its Layers Panel.

Having seen that most of the viewers are not intuitive, let’s now look at what happens if we convert a multipage document back into a single page one.

Creating a Single Page Document

Copied to clipboard

In this test, the three page document was converted back into a single page document. This was done either by:

  • Deleting pages 2 and 3 then saving the result, or
  • Saving just a subset of the full document.

The modified document was then viewed in Xodo.

Three types of results were found.

Only the Layers for the Single Page Are Present

This is the ideal result. Only the layers that relate to the single page are present. This avoids confusion, since there is only one set of layers within the Layers Panel, so you can’t click on the “wrong one.”

This result was found for PDFs created by deleting pages using Acrobat or Xodo.

A similar PDF was also created by saving just a single page of the PDF using Apryse WebViewer.

Blog image

Figure 12 – An ideal result. Only the layers that relate to the page are visible. If the Scale Bar layer is unchecked in the Layers Panel, then that layer becomes hidden, exactly as you would expect.

All Layers Are Present, Even Those that Relate to Removed Pages

In this case, even though two of the pages have been removed, the layers that were in those pages have been retained in the PDF. This has the potential to be very confusing, since you can select a layer for a page that is not only not visible, it doesn’t exist at all.

This result was created by PDF Studio Pro. It was also created by removing pages from the thumbnail viewer in Apryse WebViewer. (Note that this is a different result than what occurred by saving the PDF with just a single page.)

Blog image

Figure 13 – All of the layers are shown, even for pages that no longer exist in the document.

All Layers Removed, Even Those for the Retained Page

This is the worst result and was found by removing pages using PSPDFKit. All of the layers have been discarded, including those for the page that has been kept.

This could result in significant loss of functionality.

Blog image

Figure 14 – The file created by deleting pages using PSPDFKit appears to have lost all of its layers.

Summary

Copied to clipboard

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

Check out our blog post to learn how to create new PDFs from each layer.

Conclusion

Copied to clipboard

This is a complex niche case, which will not affect many users.

However, if you are one of those users and you have a workflow that creates multipage PDFs with nested layers, this will matter enormously.

Acrobat has the edge if it really matters that you only show the layers related to the page that is visible since it does that straight out of the box.

However, Apryse WebViewer is open source, so if you wish, you can fork the project and alter viewer behavior. Furthermore, Apryse SDK allows you to manipulate the PDF itself, offering control of the contents which may allow you to work around this complexity.

With regards to creating a single page document from a multi-page PDF that contains layers, there was no apparent difference between Acrobat, Xodo, and the Apryse WebViewer.

Once again PSPDFKit was disappointing, particularly with regard to creating single page documents since all of the layers were discarded in the process.

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 what it can do.

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