diff --git a/web/default_factory.js b/web/default_factory.js index 0ff79bfa9..ae24a5e7c 100644 --- a/web/default_factory.js +++ b/web/default_factory.js @@ -21,8 +21,6 @@ /** @typedef {import("./interfaces").IL10n} IL10n */ /** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */ // eslint-disable-next-line max-len -/** @typedef {import("./interfaces").IPDFStructTreeLayerFactory} IPDFStructTreeLayerFactory */ -// eslint-disable-next-line max-len /** @typedef {import("./interfaces").IPDFTextLayerFactory} IPDFTextLayerFactory */ /** @typedef {import("./interfaces").IPDFXfaLayerFactory} IPDFXfaLayerFactory */ /** @typedef {import("./text_highlighter").TextHighlighter} TextHighlighter */ @@ -30,22 +28,9 @@ /** @typedef {import("./text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */ import { SimpleLinkService } from "./pdf_link_service.js"; -import { StructTreeLayerBuilder } from "./struct_tree_layer_builder.js"; import { TextLayerBuilder } from "./text_layer_builder.js"; import { XfaLayerBuilder } from "./xfa_layer_builder.js"; -/** - * @implements IPDFStructTreeLayerFactory - */ -class DefaultStructTreeLayerFactory { - /** - * @returns {StructTreeLayerBuilder} - */ - createStructTreeLayerBuilder() { - return new StructTreeLayerBuilder(); - } -} - /** * @implements IPDFTextLayerFactory */ @@ -100,8 +85,4 @@ class DefaultXfaLayerFactory { } } -export { - DefaultStructTreeLayerFactory, - DefaultTextLayerFactory, - DefaultXfaLayerFactory, -}; +export { DefaultTextLayerFactory, DefaultXfaLayerFactory }; diff --git a/web/interfaces.js b/web/interfaces.js index c963cac50..3afcd4e4d 100644 --- a/web/interfaces.js +++ b/web/interfaces.js @@ -17,8 +17,6 @@ /** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */ // eslint-disable-next-line max-len /** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */ -// eslint-disable-next-line max-len -/** @typedef {import("./struct_tree_builder").StructTreeLayerBuilder} StructTreeLayerBuilder */ /** @typedef {import("./text_highlighter").TextHighlighter} TextHighlighter */ // eslint-disable-next-line max-len /** @typedef {import("./text_layer_builder").TextLayerBuilder} TextLayerBuilder */ @@ -198,16 +196,6 @@ class IPDFXfaLayerFactory { createXfaLayerBuilder({ pageDiv, pdfPage, annotationStorage = null }) {} } -/** - * @interface - */ -class IPDFStructTreeLayerFactory { - /** - * @returns {StructTreeLayerBuilder} - */ - createStructTreeLayerBuilder() {} -} - /** * @interface */ @@ -278,7 +266,6 @@ export { IDownloadManager, IL10n, IPDFLinkService, - IPDFStructTreeLayerFactory, IPDFTextLayerFactory, IPDFXfaLayerFactory, IRenderableView, diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index a3638041b..746e6a633 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -20,8 +20,6 @@ /** @typedef {import("./event_utils").EventBus} EventBus */ /** @typedef {import("./interfaces").IL10n} IL10n */ // eslint-disable-next-line max-len -/** @typedef {import("./interfaces").IPDFStructTreeLayerFactory} IPDFStructTreeLayerFactory */ -// eslint-disable-next-line max-len /** @typedef {import("./interfaces").IPDFTextLayerFactory} IPDFTextLayerFactory */ /** @typedef {import("./interfaces").IPDFXfaLayerFactory} IPDFXfaLayerFactory */ /** @typedef {import("./interfaces").IRenderableView} IRenderableView */ @@ -53,6 +51,7 @@ import { AnnotationLayerBuilder } from "./annotation_layer_builder.js"; import { compatibilityParams } from "./app_options.js"; import { NullL10n } from "./l10n_utils.js"; import { SimpleLinkService } from "./pdf_link_service.js"; +import { StructTreeLayerBuilder } from "./struct_tree_layer_builder.js"; import { TextAccessibilityManager } from "./text_accessibility.js"; /** @@ -76,7 +75,6 @@ import { TextAccessibilityManager } from "./text_accessibility.js"; * see also {@link RenderParameters} and {@link GetOperatorListParameters}. * The default value is `AnnotationMode.ENABLE_FORMS`. * @property {IPDFXfaLayerFactory} [xfaLayerFactory] - * @property {IPDFStructTreeLayerFactory} [structTreeLayerFactory] * @property {Object} [textHighlighterFactory] * @property {string} [imageResourcesPath] - Path for image resources, mainly * for annotation icons. Include trailing slash. @@ -160,7 +158,6 @@ class PDFPageView { this.textLayerFactory = options.textLayerFactory; this.xfaLayerFactory = options.xfaLayerFactory; this._textHighlighterFactory = options.textHighlighterFactory; - this.structTreeLayerFactory = options.structTreeLayerFactory; if ( typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || GENERIC") @@ -351,9 +348,7 @@ class PDFPageView { error, }); - if (this.structTreeLayerFactory) { - this.#renderStructTreeLayer(); - } + this.#renderStructTreeLayer(); } /** @@ -367,8 +362,7 @@ class PDFPageView { if (!this.textLayer) { return; } - this.structTreeLayer ||= - this.structTreeLayerFactory.createStructTreeLayerBuilder(); + this.structTreeLayer ||= new StructTreeLayerBuilder(); const tree = await (!this.structTreeLayer.renderingDone ? this.pdfPage.getStructTree() diff --git a/web/pdf_viewer.component.js b/web/pdf_viewer.component.js index cd4ba1fc5..b560e58da 100644 --- a/web/pdf_viewer.component.js +++ b/web/pdf_viewer.component.js @@ -14,7 +14,6 @@ */ import { - DefaultStructTreeLayerFactory, DefaultTextLayerFactory, DefaultXfaLayerFactory, } from "./default_factory.js"; @@ -60,6 +59,15 @@ class DefaultAnnotationLayerFactory { } } +class DefaultStructTreeLayerFactory { + constructor() { + throw new Error( + "The `DefaultStructTreeLayerFactory` has been removed, " + + "this functionality is automatically enabled when the TextLayer is used." + ); + } +} + export { AnnotationLayerBuilder, DefaultAnnotationLayerFactory, diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index 481fc01f8..0dfb3e668 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -24,8 +24,6 @@ /** @typedef {import("./interfaces").IL10n} IL10n */ /** @typedef {import("./interfaces").IPDFLinkService} IPDFLinkService */ // eslint-disable-next-line max-len -/** @typedef {import("./interfaces").IPDFStructTreeLayerFactory} IPDFStructTreeLayerFactory */ -// eslint-disable-next-line max-len /** @typedef {import("./interfaces").IPDFTextLayerFactory} IPDFTextLayerFactory */ /** @typedef {import("./interfaces").IPDFXfaLayerFactory} IPDFXfaLayerFactory */ // eslint-disable-next-line max-len @@ -69,7 +67,6 @@ import { NullL10n } from "./l10n_utils.js"; import { PDFPageView } from "./pdf_page_view.js"; import { PDFRenderingQueue } from "./pdf_rendering_queue.js"; import { SimpleLinkService } from "./pdf_link_service.js"; -import { StructTreeLayerBuilder } from "./struct_tree_layer_builder.js"; import { TextHighlighter } from "./text_highlighter.js"; import { TextLayerBuilder } from "./text_layer_builder.js"; import { XfaLayerBuilder } from "./xfa_layer_builder.js"; @@ -206,7 +203,6 @@ class PDFPageViewBuffer { /** * Simple viewer control to display PDF content/pages. * - * @implements {IPDFStructTreeLayerFactory} * @implements {IPDFTextLayerFactory} * @implements {IPDFXfaLayerFactory} */ @@ -792,7 +788,6 @@ class PDFViewer { annotationMode, xfaLayerFactory: this, textHighlighterFactory: this, - structTreeLayerFactory: this, imageResourcesPath: this.imageResourcesPath, renderer: typeof PDFJSDev === "undefined" || @@ -1732,13 +1727,6 @@ class PDFViewer { }); } - /** - * @returns {StructTreeLayerBuilder} - */ - createStructTreeLayerBuilder() { - return new StructTreeLayerBuilder(); - } - /** * @type {boolean} Whether all pages of the PDF document have identical * widths and heights.