polotno-node 1.0.0 → 1.1.0
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/README.md +8 -4
- package/dist/{client.a5a7eab1.js → client.f7f82675.js} +107 -73
- package/dist/client.html +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,7 +50,10 @@ res.json({ url });
|
|
|
50
50
|
|
|
51
51
|
// export many pages:
|
|
52
52
|
for (const page of json.pages) {
|
|
53
|
-
const url = await instance.jsonToDataURL(
|
|
53
|
+
const url = await instance.jsonToDataURL(
|
|
54
|
+
{ ...json, pages: [page] }, // for optimization, we can modify JSON to include only one page
|
|
55
|
+
{ pageId: page.id }
|
|
56
|
+
);
|
|
54
57
|
// do something with url
|
|
55
58
|
}
|
|
56
59
|
```
|
|
@@ -70,9 +73,10 @@ fs.writeFileSync('out.png', imageBase64, 'base64');
|
|
|
70
73
|
|
|
71
74
|
// export many pages:
|
|
72
75
|
for (const page of json.pages) {
|
|
73
|
-
const imageBase64 = await instance.jsonToImageBase64(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
const imageBase64 = await instance.jsonToImageBase64(
|
|
77
|
+
{ ...json, pages: [page] }, // for optimization, we can modify JSON to include only one page
|
|
78
|
+
{ pageId: page.id }
|
|
79
|
+
);
|
|
76
80
|
// do something with base64
|
|
77
81
|
}
|
|
78
82
|
```
|