From 1b33249937c7a993a22c9db0d12c1e3b31976060 Mon Sep 17 00:00:00 2001 From: Matheus Santos Date: Thu, 16 May 2024 15:37:10 -0300 Subject: [PATCH] Implement embedSvg --- apps/web/test19.html | 8 ++--- apps/web/test20.html | 4 +-- apps/web/test21.html | 2 +- apps/web/test22.html | 2 +- apps/web/test23.html | 2 +- apps/web/test24.html | 2 +- apps/web/test25.html | 8 ++--- apps/web/test26.html | 2 +- apps/web/test27.html | 6 ++-- apps/web/test28.html | 2 +- apps/web/test29.html | 15 +++++++-- src/api/PDFDocument.ts | 28 +++++++++++++++ src/api/PDFPage.ts | 32 ++++-------------- src/api/PDFPageOptions.ts | 2 -- src/api/PDFSvg.ts | 10 ++++++ src/api/index.ts | 1 + src/api/svg.ts | 71 +++++++-------------------------------- 17 files changed, 90 insertions(+), 107 deletions(-) create mode 100644 src/api/PDFSvg.ts diff --git a/apps/web/test19.html b/apps/web/test19.html index bdfd30843..36b144b80 100644 --- a/apps/web/test19.html +++ b/apps/web/test19.html @@ -248,21 +248,21 @@ y: 0, size: 20, }); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { x: 100, y: 841 /* width: 427 / 3, height: 769 / 3 */, }); - await firstPage.drawSvg(svgPowerTwo, { + firstPage.drawSvg(svgPowerTwo, { x: 550, y: 841, }); - await secondPage.drawSvg(svgDemo, { + secondPage.drawSvg(svgDemo, { x: 100, y: 841, }); - await secondPage.drawSvg(scienceSvgs, { + secondPage.drawSvg(scienceSvgs, { x: 100, y: 500, }); diff --git a/apps/web/test20.html b/apps/web/test20.html index 91318c91b..3908d63f5 100644 --- a/apps/web/test20.html +++ b/apps/web/test20.html @@ -138,11 +138,11 @@ x: 100, y: 1000 }); */ - await firstPage.drawSvg(svg3, { + firstPage.drawSvg(svg3, { x: 100, y: 950, }); - await firstPage.drawSvg(svg2, { + firstPage.drawSvg(svg2, { x: 100, y: 800, }); diff --git a/apps/web/test21.html b/apps/web/test21.html index 79e92b414..84e275e3c 100644 --- a/apps/web/test21.html +++ b/apps/web/test21.html @@ -104,7 +104,7 @@ drawLines(firstPage); drawLines(secondPage); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { x: 100, y: 800, }); diff --git a/apps/web/test22.html b/apps/web/test22.html index 1d09b45b2..746259dc4 100644 --- a/apps/web/test22.html +++ b/apps/web/test22.html @@ -179,7 +179,7 @@ // drawGrid(firstPage) drawLines(firstPage); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { height: 173.0060640625, width: 167.68455000000003, x: 100, diff --git a/apps/web/test23.html b/apps/web/test23.html index 22d2d4e5a..8c5dde7a6 100644 --- a/apps/web/test23.html +++ b/apps/web/test23.html @@ -177,7 +177,7 @@ // drawGrid(firstPage) drawLines(firstPage); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { height: 595.28, width: 841.89, // height: 100, diff --git a/apps/web/test24.html b/apps/web/test24.html index 6bf7fbb8c..b4780506a 100644 --- a/apps/web/test24.html +++ b/apps/web/test24.html @@ -171,7 +171,7 @@ // drawGrid(firstPage) drawLines(firstPage); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { height: 719, width: 611, // height: 100, diff --git a/apps/web/test25.html b/apps/web/test25.html index 74a9b3ad6..3c46d653f 100644 --- a/apps/web/test25.html +++ b/apps/web/test25.html @@ -140,7 +140,7 @@ // drawGrid(firstPage) drawLines(firstPage); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { height: 602, width: 409, // height: 32, @@ -149,21 +149,21 @@ y: 700, }); - // await firstPage.drawSvg(svg3, { + // firstPage.drawSvg(svg3, { // height: 100, // width: 100, // x: 100, // y: 700 // }) - // await firstPage.drawSvg(svg2, { + // firstPage.drawSvg(svg2, { // height: 100, // width: 100, // x: 100, // y: 500 // }) - // await firstPage.drawSvg(svg4, { + // firstPage.drawSvg(svg4, { // height: 100, // width: 100, // x: 100, diff --git a/apps/web/test26.html b/apps/web/test26.html index 535cd93b8..61d9526ba 100644 --- a/apps/web/test26.html +++ b/apps/web/test26.html @@ -145,7 +145,7 @@ // drawGrid(firstPage) drawLines(firstPage); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { height: 240.75, width: 249.75, x: 100, diff --git a/apps/web/test27.html b/apps/web/test27.html index 58d2b3f81..236285dd5 100644 --- a/apps/web/test27.html +++ b/apps/web/test27.html @@ -321,21 +321,21 @@ // drawGrid(firstPage) drawLines(firstPage); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { height: 246.75, width: 231, x: 100, y: 700, }); - await firstPage.drawSvg(cutArrowSvg, { + firstPage.drawSvg(cutArrowSvg, { height: 246.75, width: 231, x: 500, y: 700, }); - await firstPage.drawSvg(simpleCutArrowSvg, { + firstPage.drawSvg(simpleCutArrowSvg, { height: 246.75, width: 231, x: 500, diff --git a/apps/web/test28.html b/apps/web/test28.html index be48b50dc..ff1bff9eb 100644 --- a/apps/web/test28.html +++ b/apps/web/test28.html @@ -227,7 +227,7 @@ // drawGrid(firstPage) drawLines(firstPage); - await firstPage.drawSvg(svg, { + firstPage.drawSvg(svg, { height: 300, width: 400, x: 100, diff --git a/apps/web/test29.html b/apps/web/test29.html index d8c000698..f0a38c1e6 100644 --- a/apps/web/test29.html +++ b/apps/web/test29.html @@ -32,7 +32,7 @@ -