Skip to content

Commit 1d485f0

Browse files
committed
update size
1 parent 64f402e commit 1d485f0

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/content/run-export.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import { calculateExportSize } from './export-size.js';
1010
import { extensionApi } from '../shared/extension-api.js';
1111

12+
const PX_TO_MM = 25.4 / 96;
13+
1214
(async () => {
1315
try {
1416
const format = globalThis.__web2vector_format;
@@ -104,7 +106,10 @@ import { extensionApi } from '../shared/extension-api.js';
104106

105107
/* ── Document ── */
106108
case 'pdf': {
107-
const w = new writers.PDFWriter();
109+
const w = new writers.PDFWriter({
110+
pageWidth: width * PX_TO_MM,
111+
pageHeight: height * PX_TO_MM,
112+
});
108113
const doc = await renderIR(ir, w);
109114
await doc.finalize();
110115
data = doc.toBytes();

tests/service-worker.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { describe, it, expect, vi, beforeEach } from 'vitest';
2+
import { FORMATS } from '../src/shared/formats.js';
23

34
// ── Minimal chrome API stubs ──────────────────────────────
45
function createChromeStub() {
@@ -40,8 +41,7 @@ describe('service-worker message handling', () => {
4041
it('creates context-menu entries on install', async () => {
4142
await import('../src/background/service-worker.js');
4243
chrome._listeners.onInstalled?.();
43-
// 1 parent + 10 format sub-items
44-
expect(chrome.contextMenus.create).toHaveBeenCalledTimes(11);
44+
expect(chrome.contextMenus.create).toHaveBeenCalledTimes(Object.keys(FORMATS).length + 1);
4545
});
4646

4747
it('injects correct scripts for a core format (svg)', async () => {

0 commit comments

Comments
 (0)