|
3 | 3 | We sometimes bake-in solutions (A.K.A. hotfixes) to solve issues for specific use cases. |
4 | 4 |
|
5 | 5 | When we deem a hotfix will not break existing code, |
6 | | - will make it default behaviour and mark the hotfix as _accepted_, |
7 | | - At that point the define can be removed. |
8 | | - |
9 | | - To enable a hotfix, define the following member of your created PDF, |
10 | | -where the pdf.hotfix field is the name of the hotfix. |
11 | | - |
12 | | - var pdf new jsPDF(...); |
13 | | - pdf.hotfix.fill_close = true; |
14 | | - |
| 6 | +will make it default behaviour and mark the hotfix as _accepted_, |
| 7 | +At that point the define can be removed. |
| 8 | + |
| 9 | +To enable a hotfix, pass the `hotfixes` option to the jsPDF constructor: |
| 10 | + |
| 11 | +```js |
| 12 | +new jsPDF({ |
| 13 | + hotfixes: ["px_scaling"] |
| 14 | +}); |
| 15 | +``` |
| 16 | + |
15 | 17 | # Active Hotfixes |
| 18 | + |
16 | 19 | ## px_scaling |
17 | 20 |
|
18 | 21 | ### Applies To |
| 22 | + |
19 | 23 | jsPDF Core |
20 | 24 |
|
21 | 25 | ### Description |
| 26 | + |
22 | 27 | When supplying 'px' as the unit for the PDF, the internal scaling factor was being miscalculated making drawn components |
23 | | -larger than they should be. Enabling this hotfix will correct this scaling calculation and items will be drawn to the |
| 28 | +larger than they should be. Enabling this hotfix will correct this scaling calculation and items will be drawn to the |
24 | 29 | correct scale. |
25 | 30 |
|
26 | 31 | ### To Enable |
| 32 | + |
27 | 33 | To enable this hotfix, supply a 'hotfixes' array to the options object in the jsPDF constructor function, and add the |
28 | 34 | string 'px_scaling' to this array. |
29 | 35 |
|
30 | 36 | #Accepted Hotfixes |
| 37 | + |
31 | 38 | ## scale_text |
32 | 39 |
|
33 | 40 | ### Applies To |
| 41 | + |
34 | 42 | context2d plugin |
35 | 43 |
|
36 | 44 | ### Affects |
| 45 | + |
37 | 46 | Drawing and Filling Text when a scale transformation is active. |
38 | 47 |
|
39 | 48 | ### Description |
| 49 | + |
40 | 50 | jsPDF currently has no way to draw scaled text. |
41 | 51 | This hotfix scales the current font size by the x-axis scale factor. |
42 | | - |
| 52 | + |
43 | 53 | ## fill_close |
| 54 | + |
44 | 55 | ### Applies To |
| 56 | + |
45 | 57 | context2d plugin |
46 | 58 |
|
47 | 59 | ### Affects |
48 | | -Filling paths |
| 60 | + |
| 61 | +Filling paths |
49 | 62 |
|
50 | 63 | ### Description |
| 64 | + |
51 | 65 | In certain cases, closing a fill would result in a path resolving to an incorrect point. |
52 | | -The was most likely fixed when we refactored matrix logic. Enabling this hotfix will ignore a most-likely unneeded workaround. |
53 | | - |
| 66 | +The was most likely fixed when we refactored matrix logic. Enabling this hotfix will ignore a most-likely unneeded workaround. |
0 commit comments