Skip to content

Commit 205585e

Browse files
authored
Merge branch 'master' into 3318-jpeg-size-determination
2 parents 61afa43 + e080935 commit 205585e

File tree

15 files changed

+1471
-69
lines changed

15 files changed

+1471
-69
lines changed

HOTFIX_README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ correct scale.
3333
To enable this hotfix, supply a 'hotfixes' array to the options object in the jsPDF constructor function, and add the
3434
string 'px_scaling' to this array.
3535

36-
#Accepted Hotfixes
36+
# Accepted Hotfixes
3737

3838
## scale_text
3939

@@ -63,4 +63,4 @@ Filling paths
6363
### Description
6464

6565
In certain cases, closing a fill would result in a path resolving to an incorrect point.
66-
The was most likely fixed when we refactored matrix logic. Enabling this hotfix will ignore a most-likely unneeded workaround.
66+
This was most likely fixed when we refactored matrix logic. Enabling this hotfix will ignore a most-likely unneeded workaround.

ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Feature requests, bug reports etc. are very welcome as issues. But questions are
22

33
If you are facing issues with garbled Unicode characters, please refer to [#2677](https://github.com/MrRio/jsPDF/issues/2677).
44

5-
Note that new issues should follow these guidelines. Otherwise, the issue will be closed without a comment and tagged with the "Needs Information" label.
5+
Note that new issues should follow these guidelines. Otherwise, the issue will be closed without comment and tagged with the "Needs Information" label.
66

77
1. A bug should be reported as an [mcve](https://stackoverflow.com/help/mcve).
88
2. Make sure code is properly indented and [formatted](https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code) (Use ``` around code blocks).

examples/vite/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# jsPDF + Vite Test Project
2+
3+
This test project demonstrates that jsPDF now works correctly with Vite after the compatibility fix.
4+
5+
## Setup
6+
7+
```bash
8+
npm install
9+
```
10+
11+
## Development
12+
13+
```bash
14+
npm run dev
15+
```
16+
17+
Open http://localhost:5173 and click "Generate PDF" to test.
18+
19+
## Production Build
20+
21+
```bash
22+
npm run build
23+
npm run preview
24+
```
25+
26+
Open http://localhost:4173 and test the production build.
27+
28+
## What's Tested
29+
30+
- ✅ ES module import: `import { jsPDF } from "jspdf"`
31+
- ✅ PDF generation and download
32+
- ✅ Development server compatibility
33+
- ✅ Production build success
34+
35+
This confirms that GitHub issue #3851 has been resolved.

examples/vite/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + jsPDF Test</title>
8+
</head>
9+
<body>
10+
<div id="app">
11+
<h1>jsPDF + Vite Test</h1>
12+
<button id="generate-pdf">Generate PDF</button>
13+
<div id="status"></div>
14+
</div>
15+
<script type="module" src="/main.js"></script>
16+
</body>
17+
</html>

examples/vite/main.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { jsPDF } from "jspdf";
2+
3+
document.addEventListener("DOMContentLoaded", () => {
4+
const button = document.getElementById("generate-pdf");
5+
const status = document.getElementById("status");
6+
7+
button.addEventListener("click", () => {
8+
try {
9+
// Test that jsPDF import works
10+
const doc = new jsPDF();
11+
12+
doc.text(
13+
"Hello, this is a test PDF generated with jsPDF and Vite!",
14+
10,
15+
10
16+
);
17+
doc.text("If you can see this, the import issue has been fixed.", 10, 20);
18+
19+
// Save the PDF
20+
doc.save("test-vite-jspdf.pdf");
21+
22+
status.innerHTML =
23+
'<span style="color: green;">✅ Success! PDF generated successfully.</span>';
24+
status.innerHTML += "<br>jsPDF version: " + (doc.version || "unknown");
25+
} catch (error) {
26+
status.innerHTML =
27+
'<span style="color: red;">❌ Error: ' + error.message + "</span>";
28+
console.error("jsPDF Error:", error);
29+
}
30+
});
31+
32+
// Test that the import worked
33+
try {
34+
const testDoc = new jsPDF();
35+
status.innerHTML =
36+
'<span style="color: blue;">📦 jsPDF imported successfully! Click the button to test PDF generation.</span>';
37+
} catch (error) {
38+
status.innerHTML =
39+
'<span style="color: red;">❌ Import Error: ' + error.message + "</span>";
40+
}
41+
});

0 commit comments

Comments
 (0)