pdf-visual-compare 1.1.0 → 1.1.1

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 +42 -1
  2. package/package.json +10 -10
package/README.md CHANGED
@@ -1,4 +1,45 @@
1
1
  # pdf-visual-compare
2
- Visual regression testing library for PDFs in Js/Ts
2
+
3
+ Visual regression testing library for PDFs in Js/Ts without binary and OS dependencies.
3
4
 
4
5
  [![Tests on push](https://github.com/dichovsky/pdf-visual-compare/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/dichovsky/pdf-visual-compare/actions/workflows/test.yml)
6
+
7
+ ## Getting started
8
+
9
+ Installation:
10
+
11
+ ```sh
12
+ npm install -D pdf-visual-compare
13
+ ```
14
+
15
+ ## Example
16
+
17
+ ```javascript
18
+ const result: boolean = await comparePdf('./pdf1.pdf', './pdf2.pdf');
19
+
20
+ // If you want to configure comparing process, use the following props
21
+
22
+ const result: boolean = await comparePdf('./pdf1.pdf', './pdf2.pdf', {
23
+ diffsOutputFolder?: string; // Folder to write output PNG files with differences
24
+ pdfToPngConvertOptions?: {
25
+ viewportScale: 2.0, // The desired scale of PNG viewport. Default value is 1.0.
26
+ disableFontFace: false, //When `false`, fonts will be rendered using a built-in font renderer that constructs the glyphs with primitive path commands. Default value is true.
27
+ useSystemFonts: false, // When `true`, fonts that aren't embedded in the PDF document will fallback to a system font. Default value is false.
28
+ pdfFilePassword: 'pa$$word', // Password for encrypted PDF.
29
+ outputFolder: 'output/folder', // Folder to write output PNG files. If not specified, PNG output will be available only as a Buffer content, without saving to a file.
30
+ outputFileMask: 'buffer', // Output filename mask. Default value is 'buffer'.
31
+ pagesToProcess: [1, 3, 11], // Subset of pages to convert (first page = 1), other pages will be skipped if specified.
32
+ strictPagesToProcess: false // When `true`, will throw an error if specified page number in pagesToProcess is invalid, otherwise will skip invalid page. Default value is false.
33
+ verbosityLevel: 0 // Verbosity level. ERRORS: 0, WARNINGS: 1, INFOS: 5. Default value is 0.
34
+ };
35
+ excludedAreas?: ExcludedPageArea[]; // Areas list to exclude from comparing for each PDF page. Empty array by default.
36
+ compareThreshold?: number; // Comparing threshold, ranges from 0 to 1. Smaller values make the comparison more sensitive. 0.1 by default.
37
+ });
38
+
39
+ ```
40
+
41
+ ## Buy Me A Coffee
42
+
43
+ In case you want support my work
44
+
45
+ [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoffee.com/dichovsky)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-visual-compare",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Visual regression testing library for PDFs in Js/Ts without binary and OS dependencies.",
5
5
  "keywords": [
6
6
  "pdf",
@@ -43,14 +43,14 @@
43
43
  "png-visual-compare": "0.4.12"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/jest": "27.5.1",
47
- "@types/node": "17.0.34",
48
- "@typescript-eslint/eslint-plugin": "5.25.0",
49
- "@typescript-eslint/parser": "5.25.0",
50
- "eslint": "8.15.0",
51
- "jest": "28.1.0",
52
- "ts-jest": "28.0.2",
53
- "ts-node": "10.7.0",
54
- "typescript": "4.6.4"
46
+ "@types/jest": "28.1.1",
47
+ "@types/node": "17.0.41",
48
+ "@typescript-eslint/eslint-plugin": "5.27.1",
49
+ "@typescript-eslint/parser": "5.27.1",
50
+ "eslint": "8.17.0",
51
+ "jest": "28.1.1",
52
+ "ts-jest": "28.0.4",
53
+ "ts-node": "10.8.1",
54
+ "typescript": "4.7.3"
55
55
  }
56
56
  }