pdf-search-highlight 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +8 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -18,6 +18,7 @@ npm install pdf-search-highlight pdfjs-dist
18
18
  - **Multi-context search** — search multiple queries simultaneously, each highlighted with a different color
19
19
  - Cross-span highlight using `<mark>` elements
20
20
  - Navigate between matches (next/prev, auto-scroll)
21
+ - Toggle auto-scroll on/off — disable scrolling to active match when needed
21
22
  - Zoom in/out with configurable scale
22
23
  - Download loaded PDF files
23
24
  - Case sensitive toggle
@@ -84,6 +85,7 @@ import 'pdf-search-highlight/styles.css';
84
85
  const viewer = new PDFSearchViewer(container, pdfjsLib, {
85
86
  scale: 'auto', // or a number like 1.5
86
87
  pageGap: 20,
88
+ autoScroll: true, // set false to disable scroll-to-match
87
89
  });
88
90
 
89
91
  await viewer.loadPDF(file);
@@ -236,11 +238,15 @@ renderer.cleanup(); // Release resources
236
238
 
237
239
  ```js
238
240
  const search = new SearchController({
239
- classNames: { highlight: 'my-hl', activeHighlight: 'my-active' }
241
+ classNames: { highlight: 'my-hl', activeHighlight: 'my-active' },
242
+ autoScroll: true, // set false to disable scroll-to-match
240
243
  });
241
244
 
242
245
  search.setPages(pages);
243
246
 
247
+ // Toggle auto-scroll at runtime
248
+ search.autoScroll = false;
249
+
244
250
  // Single search
245
251
  search.search('query', { caseSensitive: false, flexibleWhitespace: true });
246
252
  search.search('query', { fuzzy: true, fuzzyThreshold: 0.6 });
@@ -310,6 +316,7 @@ interface PDFSearchViewerOptions {
310
316
  scale?: number | 'auto'; // Default: 'auto' (fit container width)
311
317
  workerSrc?: string; // Path to pdf.js worker
312
318
  pageGap?: number; // Gap between pages in px (default: 20)
319
+ autoScroll?: boolean; // Auto-scroll to active match (default: true)
313
320
  classNames?: ClassNames; // Custom CSS class names
314
321
  }
315
322
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-search-highlight",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Drop-in PDF viewer with text search and highlight. Vanilla JS core + React wrapper.",
5
5
  "type": "module",
6
6
  "main": "./dist/core/index.cjs",