@deckio/deck-engine 1.8.0 → 1.8.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.
- package/components/exportDeckPdf.js +11 -2
- package/package.json +1 -1
|
@@ -79,6 +79,14 @@ export async function exportDeckPdf({
|
|
|
79
79
|
|
|
80
80
|
if (document.fonts?.ready) await document.fonts.ready
|
|
81
81
|
|
|
82
|
+
// Force deck to canonical PDF dimensions so slides render at exactly
|
|
83
|
+
// PAGE_W × PAGE_H regardless of the current viewport size.
|
|
84
|
+
const origDeckCss = deck.style.cssText
|
|
85
|
+
deck.style.width = `${PAGE_W}px`
|
|
86
|
+
deck.style.height = `${PAGE_H}px`
|
|
87
|
+
await waitForPaint()
|
|
88
|
+
await wait(SETTLE_MS)
|
|
89
|
+
|
|
82
90
|
try {
|
|
83
91
|
for (let i = 0; i < totalSlides; i++) {
|
|
84
92
|
onProgress?.({ current: i + 1, total: totalSlides })
|
|
@@ -95,8 +103,8 @@ export async function exportDeckPdf({
|
|
|
95
103
|
let dataUrl
|
|
96
104
|
try {
|
|
97
105
|
dataUrl = await domToPng(active, {
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
106
|
+
width: PAGE_W,
|
|
107
|
+
height: PAGE_H,
|
|
100
108
|
backgroundColor: bg,
|
|
101
109
|
scale,
|
|
102
110
|
style: {
|
|
@@ -114,6 +122,7 @@ export async function exportDeckPdf({
|
|
|
114
122
|
pdf.addImage(dataUrl, 'PNG', 0, 0, PAGE_W, PAGE_H, undefined, 'FAST')
|
|
115
123
|
}
|
|
116
124
|
} finally {
|
|
125
|
+
deck.style.cssText = origDeckCss
|
|
117
126
|
goTo(current)
|
|
118
127
|
await waitForPaint()
|
|
119
128
|
}
|