@zumer/snapdom-pdf 1.0.1 → 1.1.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # PDF changes
2
2
 
3
+ ## 1.1.0
4
+
5
+ > 30 November 2026
6
+
7
+ **Features**
8
+
9
+ - **pdf,stream:** ship one built file for pages with no bundler and no import map [`547f955`](https://github.com/zumerlab/snapdom/commit/547f955f4be80650793a42a5b8365f313fc72916)
10
+
11
+ ## 1.0.2
12
+
13
+ > 24 November 2026
14
+
15
+ **Features**
16
+
17
+ - **pdf:** WOFF2 fonts embed, and text is painted only from a file that holds its glyphs [`9644f96`](https://github.com/zumerlab/snapdom/commit/9644f969972bd942d2a767ccc70876adc916b00c)
18
+ - **pdf:** a word painted as glyphs is in the file once [`88c831e`](https://github.com/zumerlab/snapdom/commit/88c831e4c0d07acb5a37749b15ff7fa88a2e100d)
19
+ - **pdf:** text is painted as real glyphs by default [`9c525aa`](https://github.com/zumerlab/snapdom/commit/9c525aacdefb31320542b208df6aa1891ee5e2ec)
20
+
21
+ **Refactoring**
22
+
23
+ - the vector engine writes no PDF; the PDF plugin owns all of it [`acaff7d`](https://github.com/zumerlab/snapdom/commit/acaff7d76e12661a67ae8e1214b71c69f753bcc1)
24
+ - one engine per product; the PDF plugin does not use the vector engine [`de4f795`](https://github.com/zumerlab/snapdom/commit/de4f79529174793e2800cd3517b40769d9be59d0)
25
+
26
+ **Chores**
27
+
28
+ - **pdf,vector:** require SnapDOM 3.8.3 [`548afe4`](https://github.com/zumerlab/snapdom/commit/548afe42db29c19ce6c2a1eeddd84f6c86aa1117)
29
+ - release each package from its workspace instead of sixteen root aliases [`37f6b34`](https://github.com/zumerlab/snapdom/commit/37f6b341e842f6480786b663a3bc1123de393659)
30
+
3
31
  ## 1.0.1
4
32
 
5
33
  > 9 November 2026
package/README.md CHANGED
@@ -11,7 +11,7 @@ PDF export for [SnapDOM](https://snapdom.dev/): `pdf()` adds `toPdf()` to a capt
11
11
  npm install @zumer/snapdom@latest @zumer/snapdom-pdf@latest
12
12
  ```
13
13
 
14
- It needs SnapDOM 3.4.0 or newer within 3.x. Up to SnapDOM plugins 4.x the same exporter shipped as `@zumer/snapdom-plugins/pdf`; only the import changes.
14
+ It needs SnapDOM 3.8.3 or newer within 3.x. Up to SnapDOM plugins 4.x the same exporter shipped as `@zumer/snapdom-plugins/pdf`; only the import changes.
15
15
 
16
16
  Without a bundler, map both packages in an import map and serve the whole `@zumer/snapdom-pdf` folder, because its `index.js` imports files from `src/`.
17
17
 
@@ -26,6 +26,13 @@ Without a bundler, map both packages in an import map and serve the whole `@zume
26
26
  </script>
27
27
  ```
28
28
 
29
+ A page whose Content Security Policy is `script-src 'self'` blocks that inline import map. For it the package ships one file, `dist/snapdom-pdf.mjs`, that imports SnapDOM as `./snapdom.mjs`. Copy it next to `dist/snapdom.mjs` from `@zumer/snapdom` and import both from that folder:
30
+
31
+ ```js
32
+ import { snapdom } from '/vendor/snapdom.mjs'
33
+ import { pdf } from '/vendor/snapdom-pdf.mjs'
34
+ ```
35
+
29
36
  ## Quick start
30
37
 
31
38
  ```js
@@ -97,11 +104,23 @@ Links work for `http:`, `https:`, `mailto:` and `tel:`. Any other link is left o
97
104
  | Option | Default | What it does |
98
105
  |---|---|---|
99
106
  | `embedFonts` | `true` | Embed the page's web fonts, only the letters the document uses. `'full'` embeds whole fonts; `false` none. |
100
- | `vectorText` | `false` | Draw the text as real letters instead of pixels: sharp at any zoom. |
107
+ | `vectorText` | `true` | Draw the text as real letters instead of pixels: sharp at any zoom and a lighter file. `false` keeps all the text in the image. |
108
+
109
+ The PDF can only embed fonts the capture carries, so capture with `snapdom(el, { embedFonts: true })`. Web fonts in TTF, OTF, WOFF and WOFF2 embed. System fonts have no file to embed. Copying text works the same with or without embedded fonts.
110
+
111
+ Text is drawn as real letters wherever the page's own font file can draw it, which needs embedded fonts. The rest stays as image, so the page always looks as it does on screen. These stay as image:
112
+
113
+ - right-to-left and complex scripts;
114
+ - a variable font at a weight other than the one its file was saved in;
115
+ - bold or italic the browser fakes because the page loaded no file for it;
116
+ - translucent or outlined text;
117
+ - small caps, tabular or old-style figures and other `font-feature-settings`;
118
+ - a word the browser hyphenated, and a word with a letter the font lacks;
119
+ - any text in a system font: the browser does not hand over its file.
101
120
 
102
- The PDF can only embed fonts the capture carries, so capture with `snapdom(el, { embedFonts: true })`. System fonts have no file to embed. Copying text works the same with or without embedded fonts.
121
+ The letters that are drawn leave the page image, so each one is in the file once: the PDF gets lighter and the text has no soft edge around it. Underlines, shadows and backgrounds stay in the image. A text that cannot be taken out of the image, such as the value of a form control, is not drawn and stays as image. This needs a `@zumer/snapdom` newer than 3.8.2; with an older one the letters are drawn over the image.
103
122
 
104
- `vectorText` needs embedded fonts. Right-to-left and complex scripts stay as image. With `image: false` it gives a very small text-only PDF, without borders, backgrounds or pictures.
123
+ With `image: false` it gives a very small text-only PDF, without borders, backgrounds or pictures.
105
124
 
106
125
  ## Bookmarks and accessibility
107
126
 
@@ -207,7 +226,7 @@ If the PDF does not match the page, [open an issue](https://github.com/zumerlab/
207
226
 
208
227
  ## Limits
209
228
 
210
- - Text is an image unless you use `vectorText`, so a deep zoom shows the capture's resolution.
229
+ - Text in a system font is an image, so a deep zoom shows the capture's resolution. Text in a web font is drawn as letters.
211
230
  - Closed shadow roots cannot be read.
212
231
  - Date inputs are written in ISO format, not as the browser shows them.
213
232
  - An element used as header, footer or watermark has no selectable text. A repeated table header has no links.