@pdftron/pdfnet-node-samples 10.9.0 → 10.10.0-beta
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/{samples/AddImageTest → AddImageTest}/AddImageTest.js +115 -115
- package/{samples/AdvancedImagingTest → AdvancedImagingTest}/AdvancedImagingTest.js +78 -78
- package/{samples/AnnotationTest → AnnotationTest}/AnnotationTest.js +641 -641
- package/{samples/BookmarkTest → BookmarkTest}/BookmarkTest.js +219 -219
- package/{samples/CAD2PDFTest → CAD2PDFTest}/CAD2PDFTest.js +79 -79
- package/{samples/ContentReplacerTest → ContentReplacerTest}/ContentReplacerTest.js +75 -75
- package/{samples/ConvertPrintTest → ConvertPrintTest}/ConvertPrintTest.js +153 -153
- package/{samples/ConvertTest → ConvertTest}/ConvertTest.js +203 -203
- package/{samples/DataExtractionTest → DataExtractionTest}/DataExtractionTest.js +214 -214
- package/{samples/DigitalSignaturesTest → DigitalSignaturesTest}/DigitalSignaturesTest.js +622 -527
- package/{samples/DocumentCreationTest → DocumentCreationTest}/DocumentCreationTest.js +409 -409
- package/{samples/ElementBuilderTest → ElementBuilderTest}/ElementBuilderTest.js +513 -513
- package/{samples/ElementEditTest → ElementEditTest}/ElementEditTest.js +110 -110
- package/{samples/ElementReaderAdvTest → ElementReaderAdvTest}/ElementReaderAdvTest.js +305 -305
- package/{samples/ElementReaderTest → ElementReaderTest}/ElementReaderTest.js +77 -77
- package/{samples/EncTest → EncTest}/EncTest.js +175 -175
- package/{samples/FDFTest → FDFTest}/FDFTest.js +218 -218
- package/{samples/HTML2PDFTest → HTML2PDFTest}/HTML2PDFTest.js +164 -164
- package/{samples/HighlightsTest → HighlightsTest}/HighlightsTest.js +97 -97
- package/{samples/ImageExtractTest → ImageExtractTest}/ImageExtractTest.js +129 -129
- package/{samples/ImpositionTest → ImpositionTest}/ImpositionTest.js +86 -86
- package/{samples/InteractiveFormsTest → InteractiveFormsTest}/InteractiveFormsTest.js +381 -381
- package/{samples/JBIG2Test → JBIG2Test}/JBIG2Test.js +88 -88
- package/{samples/LicenseKey → LicenseKey}/LicenseKey.js +11 -11
- package/{samples/LogicalStructureTest → LogicalStructureTest}/LogicalStructureTest.js +250 -250
- package/{samples/OCRTest → OCRTest}/OCRTest.js +235 -235
- package/{samples/OfficeTemplateTest → OfficeTemplateTest}/OfficeTemplateTest.js +79 -79
- package/{samples/OfficeToPDFTest → OfficeToPDFTest}/OfficeToPDFTest.js +125 -125
- package/{samples/OptimizerTest → OptimizerTest}/OptimizerTest.js +191 -191
- package/{samples/PDF2HtmlTest → PDF2HtmlTest}/PDF2HtmlTest.js +123 -123
- package/{samples/PDF2OfficeTest → PDF2OfficeTest}/PDF2OfficeTest.js +158 -158
- package/{samples/PDFATest → PDFATest}/PDFATest.js +85 -85
- package/{samples/PDFDocMemoryTest → PDFDocMemoryTest}/PDFDocMemoryTest.js +84 -84
- package/{samples/PDFDrawTest → PDFDrawTest}/PDFDrawTest.js +305 -305
- package/{samples/PDFLayersTest → PDFLayersTest}/PDFLayersTest.js +294 -294
- package/{samples/PDFPackageTest → PDFPackageTest}/PDFPackageTest.js +111 -111
- package/{samples/PDFPageTest → PDFPageTest}/PDFPageTest.js +189 -189
- package/{samples/PDFRedactTest → PDFRedactTest}/PDFRedactTest.js +74 -74
- package/{samples/PageLabelsTest → PageLabelsTest}/PageLabelsTest.js +138 -138
- package/{samples/PatternTest → PatternTest}/PatternTest.js +226 -226
- package/{samples/RectTest → RectTest}/RectTest.js +40 -40
- package/{samples/SDFTest → SDFTest}/SDFTest.js +87 -87
- package/{samples/StamperTest → StamperTest}/StamperTest.js +255 -255
- package/{samples/TestFiles → TestFiles}/Misc-Fixed.pfa +1166 -1166
- package/{samples/TestFiles → TestFiles}/SHA-2 Root USERTrust RSA CA Sectigo timestamping.crt +34 -34
- package/{samples/TestFiles → TestFiles}/form1_annots.xfdf +33 -33
- package/{samples/TestFiles → TestFiles}/form1_data.xfdf +139 -139
- package/{samples/TestFiles → TestFiles}/my_stream.txt +2310 -2310
- package/{samples/TestFiles → TestFiles}/tiger.svg +378 -378
- package/{samples/TextExtractTest → TextExtractTest}/TextExtractTest.js +286 -286
- package/{samples/TextSearchTest → TextSearchTest}/TextSearchTest.js +121 -121
- package/{samples/U3DTest → U3DTest}/U3DTest.js +104 -104
- package/{samples/UndoRedoTest → UndoRedoTest}/UndoRedoTest.js +101 -101
- package/{samples/UnicodeWriteTest → UnicodeWriteTest}/UnicodeWriteTest.js +173 -173
- package/{samples/WebViewerConvertTest → WebViewerConvertTest}/WebViewerConvertTest.js +135 -135
- package/legal.txt +632 -0
- package/license.pdf +0 -0
- package/package.json +20 -21
- package/readme.md +38 -13
- package/{samples/runall.bat → runall.bat} +12 -12
- package/{samples/runall.sh → runall.sh} +15 -15
- /package/{samples/TestFiles → TestFiles}/BusinessCardTemplate.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/Fishermen.docx +0 -0
- /package/{samples/TestFiles → TestFiles}/Font_licenses.txt +0 -0
- /package/{samples/TestFiles → TestFiles}/GlobalSignRootForTST.cer +0 -0
- /package/{samples/TestFiles → TestFiles}/License.txt +0 -0
- /package/{samples/TestFiles → TestFiles}/NotoSans_with_hindi.ttf +0 -0
- /package/{samples/TestFiles → TestFiles}/Output/empty +0 -0
- /package/{samples/TestFiles → TestFiles}/SYH_Letter.docx +0 -0
- /package/{samples/TestFiles → TestFiles}/TigerText.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/US061222892-a.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/butterfly.png +0 -0
- /package/{samples/TestFiles → TestFiles}/credit card numbers.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/dice.jpg +0 -0
- /package/{samples/TestFiles → TestFiles}/dice.u3d +0 -0
- /package/{samples/TestFiles → TestFiles}/doc_to_sign.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/factsheet_Arabic.docx +0 -0
- /package/{samples/TestFiles → TestFiles}/financial.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/fish.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/font.ttf +0 -0
- /package/{samples/TestFiles → TestFiles}/form1.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/form1_data.fdf +0 -0
- /package/{samples/TestFiles → TestFiles}/formfields-scanned-withfields.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/formfields-scanned.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/formfields.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/grayscale.tif +0 -0
- /package/{samples/TestFiles → TestFiles}/hindi_sample_utf16le.txt +0 -0
- /package/{samples/TestFiles → TestFiles}/imagemask.dat +0 -0
- /package/{samples/TestFiles → TestFiles}/logo_red.png +0 -0
- /package/{samples/TestFiles → TestFiles}/lorem_ipsum.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/multipage.tif +0 -0
- /package/{samples/TestFiles → TestFiles}/newsletter.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/newsletter.xod +0 -0
- /package/{samples/TestFiles → TestFiles}/numbered.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/op_blend_test.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/palm.jp2 +0 -0
- /package/{samples/TestFiles → TestFiles}/paragraphs_and_tables.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/pdfnet.gif +0 -0
- /package/{samples/TestFiles → TestFiles}/pdftron.bmp +0 -0
- /package/{samples/TestFiles → TestFiles}/pdftron.cer +0 -0
- /package/{samples/TestFiles → TestFiles}/pdftron.pfx +0 -0
- /package/{samples/TestFiles → TestFiles}/pdftron_smart_substitution.plugin +0 -0
- /package/{samples/TestFiles → TestFiles}/peppers.jpg +0 -0
- /package/{samples/TestFiles → TestFiles}/signature.jpg +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-emf.emf +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-excel_2007.xlsx +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-outlook.msg +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-powerpoint_2007.pptx +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-publisher.pub +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-rtf.rtf +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-text.txt +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-visio.vsd +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage.html +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage.mht +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/colorschememapping.xml +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/filelist.xml +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/image001.gif +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/image002.png +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/image003.jpg +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/image004.emz +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/image005.gif +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/image006.png +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/image007.gif +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/oledata.mso +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-webpage_files/themedata.thmx +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-word_2007.docx +0 -0
- /package/{samples/TestFiles → TestFiles}/simple-xps.xps +0 -0
- /package/{samples/TestFiles → TestFiles}/table.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/tagged.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/the_rime_of_the_ancient_mariner.docx +0 -0
- /package/{samples/TestFiles → TestFiles}/tiger.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/waiver.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/waiver_withApprovalField.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/waiver_withApprovalField_certified.pdf +0 -0
- /package/{samples/TestFiles → TestFiles}/waiver_withApprovalField_certified_approved.pdf +0 -0
|
@@ -1,514 +1,514 @@
|
|
|
1
|
-
//---------------------------------------------------------------------------------------
|
|
2
|
-
// Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
|
|
3
|
-
// Consult legal.txt regarding legal and license information.
|
|
4
|
-
//---------------------------------------------------------------------------------------
|
|
5
|
-
|
|
6
|
-
const { PDFNet } = require('@pdftron/pdfnet-node');
|
|
7
|
-
const PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
8
|
-
|
|
9
|
-
((exports) => {
|
|
10
|
-
|
|
11
|
-
exports.runElementBuilderTest = () => {
|
|
12
|
-
|
|
13
|
-
const main = async() => {
|
|
14
|
-
let ret = 0;
|
|
15
|
-
|
|
16
|
-
// Relative path to the folder containing test files.
|
|
17
|
-
const inputPath = '../TestFiles/';
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const doc = await PDFNet.PDFDoc.create();
|
|
21
|
-
|
|
22
|
-
// ElementBuilder is used to build new Element objects
|
|
23
|
-
const eb = await PDFNet.ElementBuilder.create();
|
|
24
|
-
// ElementWriter is used to write Elements to the page
|
|
25
|
-
const writer = await PDFNet.ElementWriter.create();
|
|
26
|
-
|
|
27
|
-
let element;
|
|
28
|
-
let gstate;
|
|
29
|
-
|
|
30
|
-
// Start a new page ------------------------------------
|
|
31
|
-
|
|
32
|
-
const pageRect = await PDFNet.Rect.init(0, 0, 612, 794);
|
|
33
|
-
let page = await doc.pageCreate(pageRect);
|
|
34
|
-
|
|
35
|
-
// begin writing to the page
|
|
36
|
-
writer.beginOnPage(page);
|
|
37
|
-
|
|
38
|
-
// Create an Image that can be reused in the document or on the same page.
|
|
39
|
-
const img = await PDFNet.Image.createFromFile(doc, inputPath + 'peppers.jpg');
|
|
40
|
-
|
|
41
|
-
element = await eb.createImageFromMatrix(img, await PDFNet.Matrix2D.create((await img.getImageWidth()) / 2, -145, 20, (await img.getImageHeight()) / 2, 200, 150));
|
|
42
|
-
writer.writePlacedElement(element);
|
|
43
|
-
|
|
44
|
-
// use the same image (just change its matrix)
|
|
45
|
-
gstate = await element.getGState();
|
|
46
|
-
gstate.setTransform(200, 0, 0, 300, 50, 450);
|
|
47
|
-
writer.writePlacedElement(element);
|
|
48
|
-
|
|
49
|
-
// use the same image again (just change its matrix).
|
|
50
|
-
writer.writePlacedElement(await eb.createImageScaled(img, 300, 600, 200, -150));
|
|
51
|
-
|
|
52
|
-
writer.end(); // save changes to the current page
|
|
53
|
-
doc.pagePushBack(page);
|
|
54
|
-
|
|
55
|
-
// Start a new page ------------------------------------
|
|
56
|
-
// Construct and draw a path object using different styles
|
|
57
|
-
page = await doc.pageCreate(pageRect);
|
|
58
|
-
|
|
59
|
-
// begin writing to this page
|
|
60
|
-
writer.beginOnPage(page);
|
|
61
|
-
// Reset the GState to default
|
|
62
|
-
eb.reset();
|
|
63
|
-
|
|
64
|
-
// start constructing the path
|
|
65
|
-
eb.pathBegin();
|
|
66
|
-
eb.moveTo(306, 396);
|
|
67
|
-
eb.curveTo(681, 771, 399.75, 864.75, 306, 771);
|
|
68
|
-
eb.curveTo(212.25, 864.75, -69, 771, 306, 396);
|
|
69
|
-
eb.closePath();
|
|
70
|
-
// the path is now finished
|
|
71
|
-
element = await eb.pathEnd();
|
|
72
|
-
// the path should be filled
|
|
73
|
-
element.setPathFill(true);
|
|
74
|
-
|
|
75
|
-
// Set the path color space and color
|
|
76
|
-
gstate = await element.getGState();
|
|
77
|
-
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceCMYK());
|
|
78
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0, 0)); // cyan
|
|
79
|
-
gstate.setTransform(0.5, 0, 0, 0.5, -20, 300);
|
|
80
|
-
writer.writePlacedElement(element);
|
|
81
|
-
|
|
82
|
-
// Draw the same path using a different stroke color
|
|
83
|
-
// this path is should be filled and stroked
|
|
84
|
-
element.setPathStroke(true);
|
|
85
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 0, 1, 0)); // yellow
|
|
86
|
-
gstate.setStrokeColorSpace(await PDFNet.ColorSpace.createDeviceRGB());
|
|
87
|
-
gstate.setStrokeColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0)); // red
|
|
88
|
-
gstate.setTransform(0.5, 0, 0, 0.5, 280, 300);
|
|
89
|
-
gstate.setLineWidth(20);
|
|
90
|
-
writer.writePlacedElement(element);
|
|
91
|
-
|
|
92
|
-
// Draw the same path with with a given dash pattern
|
|
93
|
-
// this path is should be only stroked
|
|
94
|
-
element.setPathFill(false);
|
|
95
|
-
gstate.setStrokeColorWithColorPt(await PDFNet.ColorPt.init(0, 0, 1)); // blue
|
|
96
|
-
gstate.setTransform(0.5, 0, 0, 0.5, 280, 0);
|
|
97
|
-
const dashPattern = [];
|
|
98
|
-
dashPattern.push(30);
|
|
99
|
-
gstate.setDashPattern(dashPattern, 0);
|
|
100
|
-
writer.writePlacedElement(element);
|
|
101
|
-
|
|
102
|
-
// Use the path as a clipping path
|
|
103
|
-
// Save the graphics state
|
|
104
|
-
writer.writeElement(await eb.createGroupBegin());
|
|
105
|
-
// Start constructing the new path (the old path was lost when we created
|
|
106
|
-
// a new Element using CreateGroupBegin()).
|
|
107
|
-
eb.pathBegin();
|
|
108
|
-
eb.moveTo(306, 396);
|
|
109
|
-
eb.curveTo(681, 771, 399.75, 864.75, 306, 771);
|
|
110
|
-
eb.curveTo(212.25, 864.75, -69, 771, 306, 396);
|
|
111
|
-
eb.closePath();
|
|
112
|
-
// path is now constructed
|
|
113
|
-
element = await eb.pathEnd();
|
|
114
|
-
// this path is a clipping path
|
|
115
|
-
element.setPathClip(true);
|
|
116
|
-
// this path should be filled and stroked
|
|
117
|
-
element.setPathStroke(true);
|
|
118
|
-
gstate = await element.getGState();
|
|
119
|
-
gstate.setTransform(0.5, 0, 0, 0.5, -20, 0);
|
|
120
|
-
|
|
121
|
-
writer.writeElement(element);
|
|
122
|
-
|
|
123
|
-
writer.writeElement(await eb.createImageScaled(img, 100, 300, 400, 600));
|
|
124
|
-
|
|
125
|
-
// Restore the graphics state
|
|
126
|
-
writer.writeElement(await eb.createGroupEnd());
|
|
127
|
-
|
|
128
|
-
writer.end(); // save changes to the current page
|
|
129
|
-
doc.pagePushBack(page);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// Start a new page ------------------------------------
|
|
133
|
-
page = await doc.pageCreate(pageRect);
|
|
134
|
-
|
|
135
|
-
// begin writing to this page
|
|
136
|
-
writer.beginOnPage(page);
|
|
137
|
-
// Reset the GState to default
|
|
138
|
-
eb.reset();
|
|
139
|
-
|
|
140
|
-
// Begin writing a block of text
|
|
141
|
-
element = await eb.createTextBeginWithFont(await PDFNet.Font.create(doc, PDFNet.Font.StandardType1Font.e_times_roman), 12);
|
|
142
|
-
writer.writeElement(element);
|
|
143
|
-
|
|
144
|
-
element = await eb.createNewTextRun('Hello World!');
|
|
145
|
-
element.setTextMatrixEntries(10, 0, 0, 10, 0, 600);
|
|
146
|
-
gstate = await element.getGState();
|
|
147
|
-
// Set the spacing between lines
|
|
148
|
-
gstate.setLeading(15);
|
|
149
|
-
writer.writeElement(element);
|
|
150
|
-
|
|
151
|
-
writer.writeElement(await eb.createTextNewLine()); // New line
|
|
152
|
-
|
|
153
|
-
element = await eb.createNewTextRun('Hello World!');
|
|
154
|
-
gstate = await element.getGState();
|
|
155
|
-
gstate.setTextRenderMode(PDFNet.GState.TextRenderingMode.e_stroke_text);
|
|
156
|
-
gstate.setCharSpacing(-1.25);
|
|
157
|
-
gstate.setWordSpacing(-1.25);
|
|
158
|
-
writer.writeElement(element);
|
|
159
|
-
|
|
160
|
-
writer.writeElement(await eb.createTextNewLine()); // New line
|
|
161
|
-
|
|
162
|
-
element = await eb.createNewTextRun('Hello World!');
|
|
163
|
-
gstate = await element.getGState();
|
|
164
|
-
gstate.setCharSpacing(0);
|
|
165
|
-
gstate.setWordSpacing(0);
|
|
166
|
-
gstate.setLineWidth(3);
|
|
167
|
-
gstate.setTextRenderMode(PDFNet.GState.TextRenderingMode.e_fill_stroke_text);
|
|
168
|
-
gstate.setStrokeColorSpace(await PDFNet.ColorSpace.createDeviceRGB());
|
|
169
|
-
gstate.setStrokeColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0)); // red
|
|
170
|
-
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceCMYK());
|
|
171
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0, 0)); // cyan
|
|
172
|
-
writer.writeElement(element);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
writer.writeElement(await eb.createTextNewLine()); // New line
|
|
176
|
-
|
|
177
|
-
// Set text as a clipping path to the image.
|
|
178
|
-
element = await eb.createNewTextRun('Hello World!');
|
|
179
|
-
gstate = await element.getGState();
|
|
180
|
-
gstate.setTextRenderMode(PDFNet.GState.TextRenderingMode.e_clip_text);
|
|
181
|
-
writer.writeElement(element);
|
|
182
|
-
|
|
183
|
-
// Finish the block of text
|
|
184
|
-
writer.writeElement(await eb.createTextEnd());
|
|
185
|
-
|
|
186
|
-
// Draw an image that will be clipped by the above text
|
|
187
|
-
writer.writeElement(await eb.createImageScaled(img, 10, 100, 1300, 720));
|
|
188
|
-
|
|
189
|
-
writer.end(); // save changes to the current page
|
|
190
|
-
doc.pagePushBack(page);
|
|
191
|
-
|
|
192
|
-
// Start a new page ------------------------------------
|
|
193
|
-
//
|
|
194
|
-
// The example illustrates how to embed the external font in a PDF document.
|
|
195
|
-
// The example also shows how ElementReader can be used to copy and modify
|
|
196
|
-
// Elements between pages.
|
|
197
|
-
|
|
198
|
-
const reader = await PDFNet.ElementReader.create();
|
|
199
|
-
|
|
200
|
-
// Start reading Elements from the last page. We will copy all Elements to
|
|
201
|
-
// a new page but will modify the font associated with text.
|
|
202
|
-
reader.beginOnPage(await doc.getPage(await doc.getPageCount()));
|
|
203
|
-
|
|
204
|
-
page = await doc.pageCreate(await PDFNet.Rect.init(0, 0, 1300, 794));
|
|
205
|
-
|
|
206
|
-
// begin writing to this page
|
|
207
|
-
writer.beginOnPage(page);
|
|
208
|
-
// Reset the GState to default
|
|
209
|
-
eb.reset();
|
|
210
|
-
|
|
211
|
-
const font = await PDFNet.Font.createTrueTypeFont(doc, inputPath + 'font.ttf');
|
|
212
|
-
|
|
213
|
-
// Read page contents
|
|
214
|
-
while ((element = await reader.next())) {
|
|
215
|
-
if ((await element.getType()) === PDFNet.Element.Type.e_text) {
|
|
216
|
-
(await element.getGState()).setFont(font, 12);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
writer.writeElement(element);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
reader.end();
|
|
223
|
-
writer.end(); // save changes to the current page
|
|
224
|
-
|
|
225
|
-
doc.pagePushBack(page);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
// Start a new page ------------------------------------
|
|
229
|
-
//
|
|
230
|
-
// The example also shows how ElementReader can be used to copy and modify
|
|
231
|
-
// Elements between pages.
|
|
232
|
-
|
|
233
|
-
// Start reading Elements from the last page. We will copy all Elements to
|
|
234
|
-
// a new page but will modify the font associated with text.
|
|
235
|
-
reader.beginOnPage(await doc.getPage(await doc.getPageCount()));
|
|
236
|
-
|
|
237
|
-
page = await doc.pageCreate(await PDFNet.Rect.init(0, 0, 1300, 794));
|
|
238
|
-
|
|
239
|
-
// begin writing to this page
|
|
240
|
-
writer.beginOnPage(page);
|
|
241
|
-
// Reset the GState to default
|
|
242
|
-
eb.reset();
|
|
243
|
-
|
|
244
|
-
// Embed an external font in the document.
|
|
245
|
-
const font2 = await PDFNet.Font.createType1Font(doc, inputPath + 'Misc-Fixed.pfa');
|
|
246
|
-
|
|
247
|
-
// Read page contents
|
|
248
|
-
while ((element = await reader.next())) {
|
|
249
|
-
if ((await element.getType()) === PDFNet.Element.Type.e_text) {
|
|
250
|
-
(await element.getGState()).setFont(font2, 12);
|
|
251
|
-
}
|
|
252
|
-
writer.writeElement(element);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
reader.end();
|
|
256
|
-
writer.end(); // save changes to the current page
|
|
257
|
-
doc.pagePushBack(page);
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
// Start a new page ------------------------------------
|
|
261
|
-
page = await doc.pageCreate();
|
|
262
|
-
// begin writing to this page
|
|
263
|
-
writer.beginOnPage(page);
|
|
264
|
-
// Reset the GState to default
|
|
265
|
-
eb.reset();
|
|
266
|
-
|
|
267
|
-
// Begin writing a block of text
|
|
268
|
-
element = await eb.createTextBeginWithFont(await PDFNet.Font.create(doc, PDFNet.Font.StandardType1Font.e_times_roman), 12);
|
|
269
|
-
element.setTextMatrixEntries(1.5, 0, 0, 1.5, 50, 600);
|
|
270
|
-
// Set the spacing between lines
|
|
271
|
-
(await element.getGState()).setLeading(15);
|
|
272
|
-
writer.writeElement(element);
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const para = 'A PDF text object consists of operators that can show '
|
|
276
|
-
+ 'text strings, move the text position, and set text state and certain '
|
|
277
|
-
+ 'other parameters. In addition, there are three parameters that are '
|
|
278
|
-
+ 'defined only within a text object and do not persist from one text '
|
|
279
|
-
+ 'object to the next: Tm, the text matrix, Tlm, the text line matrix, '
|
|
280
|
-
+ 'Trm, the text rendering matrix, actually just an intermediate result '
|
|
281
|
-
+ 'that combines the effects of text state parameters, the text matrix '
|
|
282
|
-
+ '(Tm), and the current transformation matrix';
|
|
283
|
-
|
|
284
|
-
const paraEnd = para.length;
|
|
285
|
-
let textRun = 0;
|
|
286
|
-
let textRunEnd;
|
|
287
|
-
|
|
288
|
-
const paraWidth = 300; // paragraph width is 300 units
|
|
289
|
-
let curWidth = 0;
|
|
290
|
-
|
|
291
|
-
while (textRun < paraEnd) {
|
|
292
|
-
textRunEnd = para.indexOf(' ', textRun);
|
|
293
|
-
if (textRunEnd < 0) {
|
|
294
|
-
textRunEnd = paraEnd - 1;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
let text = para.substring(textRun, textRunEnd + 1);
|
|
298
|
-
element = await eb.createNewTextRun(text);
|
|
299
|
-
if (curWidth + (await element.getTextLength()) < paraWidth) {
|
|
300
|
-
curWidth += await element.getTextLength();
|
|
301
|
-
} else {
|
|
302
|
-
writer.writeElement(await eb.createTextNewLine()); // New line
|
|
303
|
-
element = await eb.createNewTextRun(text);
|
|
304
|
-
curWidth = await element.getTextLength();
|
|
305
|
-
}
|
|
306
|
-
writer.writeElement(element);
|
|
307
|
-
|
|
308
|
-
textRun = textRunEnd + 1;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// -----------------------------------------------------------------------
|
|
312
|
-
// The following code snippet illustrates how to adjust spacing between
|
|
313
|
-
// characters (text runs).
|
|
314
|
-
element = await eb.createTextNewLine();
|
|
315
|
-
writer.writeElement(element); // Skip 2 lines
|
|
316
|
-
writer.writeElement(element);
|
|
317
|
-
|
|
318
|
-
writer.writeElement(await eb.createNewTextRun('An example of space adjustments between inter-characters:'));
|
|
319
|
-
writer.writeElement(await eb.createTextNewLine());
|
|
320
|
-
|
|
321
|
-
// Write string "AWAY" without space adjustments between characters.
|
|
322
|
-
element = await eb.createNewTextRun('AWAY');
|
|
323
|
-
writer.writeElement(element);
|
|
324
|
-
|
|
325
|
-
writer.writeElement(await eb.createTextNewLine());
|
|
326
|
-
|
|
327
|
-
// Write string "AWAY" with space adjustments between characters.
|
|
328
|
-
element = await eb.createNewTextRun('A');
|
|
329
|
-
writer.writeElement(element);
|
|
330
|
-
|
|
331
|
-
element = await eb.createNewTextRun('W');
|
|
332
|
-
element.setPosAdjustment(140);
|
|
333
|
-
writer.writeElement(element);
|
|
334
|
-
|
|
335
|
-
element = await eb.createNewTextRun('A');
|
|
336
|
-
element.setPosAdjustment(140);
|
|
337
|
-
writer.writeElement(element);
|
|
338
|
-
|
|
339
|
-
element = await eb.createNewTextRun('Y again');
|
|
340
|
-
element.setPosAdjustment(115);
|
|
341
|
-
writer.writeElement(element);
|
|
342
|
-
|
|
343
|
-
// Draw the same strings using direct content output...
|
|
344
|
-
writer.flush(); // flush pending Element writing operations.
|
|
345
|
-
|
|
346
|
-
// You can also write page content directly to the content stream using
|
|
347
|
-
// ElementWriter.WriteString(...) and ElementWriter.WriteBuffer(...) methods.
|
|
348
|
-
// Note that if you are planning to use these functions you need to be familiar
|
|
349
|
-
// with PDF page content operators (see Appendix A in PDF Reference Manual).
|
|
350
|
-
// Because it is easy to make mistakes during direct output we recommend that
|
|
351
|
-
// you use ElementBuilder and Element interface instead.
|
|
352
|
-
|
|
353
|
-
writer.writeString('T* T* '); // Skip 2 lines
|
|
354
|
-
writer.writeString('(Direct output to PDF page content stream:) Tj T* ');
|
|
355
|
-
writer.writeString('(AWAY) Tj T* ');
|
|
356
|
-
writer.writeString('[(A)140(W)140(A)115(Y again)] TJ ');
|
|
357
|
-
|
|
358
|
-
// Finish the block of text
|
|
359
|
-
writer.writeElement(await eb.createTextEnd());
|
|
360
|
-
|
|
361
|
-
writer.end(); // save changes to the current page
|
|
362
|
-
doc.pagePushBack(page);
|
|
363
|
-
|
|
364
|
-
// Start a new page ------------------------------------
|
|
365
|
-
|
|
366
|
-
// Image Masks
|
|
367
|
-
//
|
|
368
|
-
// In the opaque imaging model, images mark all areas they occupy on the page as
|
|
369
|
-
// if with opaque paint. All portions of the image, whether black, white, gray,
|
|
370
|
-
// or color, completely obscure any marks that may previously have existed in the
|
|
371
|
-
// same place on the page.
|
|
372
|
-
// In the graphic arts industry and page layout applications, however, it is common
|
|
373
|
-
// to crop or 'mask out' the background of an image and then place the masked image
|
|
374
|
-
// on a different background, allowing the existing background to show through the
|
|
375
|
-
// masked areas. This sample illustrates how to use image masks.
|
|
376
|
-
|
|
377
|
-
page = await doc.pageCreate();
|
|
378
|
-
// begin writing to the page
|
|
379
|
-
writer.beginOnPage(page);
|
|
380
|
-
|
|
381
|
-
// Create the Image Mask
|
|
382
|
-
const embedFile = await PDFNet.Filter.createMappedFileFromUString(inputPath + 'imagemask.dat');
|
|
383
|
-
const maskRead = await PDFNet.FilterReader.create(embedFile);
|
|
384
|
-
|
|
385
|
-
const deviceGray = await PDFNet.ColorSpace.createDeviceGray();
|
|
386
|
-
const mask = await PDFNet.Image.createDirectFromStream(doc, maskRead, 64, 64, 1, deviceGray, PDFNet.Image.InputFilter.e_ascii_hex);
|
|
387
|
-
|
|
388
|
-
(await mask.getSDFObj()).putBool('ImageMask', true);
|
|
389
|
-
|
|
390
|
-
element = await eb.createRect(0, 0, 612, 794);
|
|
391
|
-
element.setPathStroke(false);
|
|
392
|
-
element.setPathFill(true);
|
|
393
|
-
gstate = await element.getGState();
|
|
394
|
-
|
|
395
|
-
gstate.setFillColorSpace(deviceGray);
|
|
396
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0.8));
|
|
397
|
-
writer.writePlacedElement(element);
|
|
398
|
-
|
|
399
|
-
element = await eb.createImageFromMatrix(mask, await PDFNet.Matrix2D.create(200, 0, 0, -200, 40, 680));
|
|
400
|
-
(await element.getGState()).setFillColorWithColorPt(await PDFNet.ColorPt.init(0.1));
|
|
401
|
-
writer.writePlacedElement(element);
|
|
402
|
-
|
|
403
|
-
gstate = await element.getGState();
|
|
404
|
-
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceRGB());
|
|
405
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0));
|
|
406
|
-
element = await eb.createImageFromMatrix(mask, await PDFNet.Matrix2D.create(200, 0, 0, -200, 320, 680));
|
|
407
|
-
writer.writePlacedElement(element);
|
|
408
|
-
|
|
409
|
-
(await element.getGState()).setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 1, 0));
|
|
410
|
-
element = await eb.createImageFromMatrix(mask, await PDFNet.Matrix2D.create(200, 0, 0, -200, 40, 380));
|
|
411
|
-
writer.writePlacedElement(element);
|
|
412
|
-
|
|
413
|
-
{
|
|
414
|
-
// This sample illustrates Explicit Masking.
|
|
415
|
-
const img = await PDFNet.Image.createFromFile(doc, (inputPath + 'peppers.jpg'));
|
|
416
|
-
|
|
417
|
-
// mask is the explicit mask for the primary (base) image
|
|
418
|
-
img.setMask(mask);
|
|
419
|
-
|
|
420
|
-
element = await eb.createImageFromMatrix(img, await PDFNet.Matrix2D.create(200, 0, 0, -200, 320, 380));
|
|
421
|
-
writer.writePlacedElement(element);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
writer.end(); // save changes to the current page
|
|
425
|
-
doc.pagePushBack(page);
|
|
426
|
-
|
|
427
|
-
// Transparency sample ----------------------------------
|
|
428
|
-
|
|
429
|
-
// Start a new page -------------------------------------
|
|
430
|
-
page = await doc.pageCreate();
|
|
431
|
-
// begin writing to this page
|
|
432
|
-
writer.beginOnPage(page);
|
|
433
|
-
// Reset the GState to default
|
|
434
|
-
eb.reset();
|
|
435
|
-
|
|
436
|
-
// Write some transparent text at the bottom of the page.
|
|
437
|
-
element = await eb.createTextBeginWithFont(await PDFNet.Font.create(doc, PDFNet.Font.StandardType1Font.e_times_roman), 100);
|
|
438
|
-
|
|
439
|
-
// Set the text knockout attribute. Text knockout must be set outside of
|
|
440
|
-
// the text group.
|
|
441
|
-
gstate = await element.getGState();
|
|
442
|
-
gstate.setTextKnockout(false);
|
|
443
|
-
gstate.setBlendMode(PDFNet.GState.BlendMode.e_bl_difference);
|
|
444
|
-
writer.writeElement(element);
|
|
445
|
-
|
|
446
|
-
element = await eb.createNewTextRun('Transparency');
|
|
447
|
-
element.setTextMatrixEntries(1, 0, 0, 1, 30, 30);
|
|
448
|
-
gstate = await element.getGState();
|
|
449
|
-
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceCMYK());
|
|
450
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0, 0));
|
|
451
|
-
|
|
452
|
-
gstate.setFillOpacity(0.5);
|
|
453
|
-
writer.writeElement(element);
|
|
454
|
-
|
|
455
|
-
// Write the same text on top the old; shifted by 3 points
|
|
456
|
-
element.setTextMatrixEntries(1, 0, 0, 1, 33, 33);
|
|
457
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 1, 0, 0));
|
|
458
|
-
gstate.setFillOpacity(0.5);
|
|
459
|
-
|
|
460
|
-
writer.writeElement(element);
|
|
461
|
-
writer.writeElement(await eb.createTextEnd());
|
|
462
|
-
|
|
463
|
-
// Draw three overlapping transparent circles.
|
|
464
|
-
// start constructing the path
|
|
465
|
-
eb.pathBegin();
|
|
466
|
-
eb.moveTo(459.223, 505.646);
|
|
467
|
-
eb.curveTo(459.223, 415.841, 389.85, 343.04, 304.273, 343.04);
|
|
468
|
-
eb.curveTo(218.697, 343.04, 149.324, 415.841, 149.324, 505.646);
|
|
469
|
-
eb.curveTo(149.324, 595.45, 218.697, 668.25, 304.273, 668.25);
|
|
470
|
-
eb.curveTo(389.85, 668.25, 459.223, 595.45, 459.223, 505.646);
|
|
471
|
-
element = await eb.pathEnd();
|
|
472
|
-
element.setPathFill(true);
|
|
473
|
-
|
|
474
|
-
gstate = await element.getGState();
|
|
475
|
-
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceRGB());
|
|
476
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 0, 1)); // Blue Circle
|
|
477
|
-
|
|
478
|
-
gstate.setBlendMode(PDFNet.GState.BlendMode.e_bl_normal);
|
|
479
|
-
gstate.setFillOpacity(0.5);
|
|
480
|
-
writer.writeElement(element);
|
|
481
|
-
|
|
482
|
-
// Translate relative to the Blue Circle
|
|
483
|
-
gstate.setTransform(1, 0, 0, 1, 113, -185);
|
|
484
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 1, 0)); // Green Circle
|
|
485
|
-
gstate.setFillOpacity(0.5);
|
|
486
|
-
writer.writeElement(element);
|
|
487
|
-
|
|
488
|
-
// Translate relative to the Green Circle
|
|
489
|
-
gstate.setTransform(1, 0, 0, 1, -220, 0);
|
|
490
|
-
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0)); // Red Circle
|
|
491
|
-
gstate.setFillOpacity(0.5);
|
|
492
|
-
writer.writeElement(element);
|
|
493
|
-
|
|
494
|
-
writer.end(); // save changes to the current page
|
|
495
|
-
doc.pagePushBack(page);
|
|
496
|
-
|
|
497
|
-
// End page ------------------------------------
|
|
498
|
-
|
|
499
|
-
await doc.save('../TestFiles/Output/element_builder.pdf', PDFNet.SDFDoc.SaveOptions.e_remove_unused);
|
|
500
|
-
|
|
501
|
-
console.log('Done. Result saved in element_builder.pdf...');
|
|
502
|
-
} catch (e) {
|
|
503
|
-
console.log(e);
|
|
504
|
-
ret = 1;
|
|
505
|
-
}
|
|
506
|
-
return ret;
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function(error){console.log('Error: ' + JSON.stringify(error));}).then(function(){return PDFNet.shutdown();});
|
|
510
|
-
};
|
|
511
|
-
exports.runElementBuilderTest();
|
|
512
|
-
})(exports);
|
|
513
|
-
// eslint-disable-next-line spaced-comment
|
|
1
|
+
//---------------------------------------------------------------------------------------
|
|
2
|
+
// Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
|
|
3
|
+
// Consult legal.txt regarding legal and license information.
|
|
4
|
+
//---------------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
const { PDFNet } = require('@pdftron/pdfnet-node');
|
|
7
|
+
const PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
8
|
+
|
|
9
|
+
((exports) => {
|
|
10
|
+
|
|
11
|
+
exports.runElementBuilderTest = () => {
|
|
12
|
+
|
|
13
|
+
const main = async() => {
|
|
14
|
+
let ret = 0;
|
|
15
|
+
|
|
16
|
+
// Relative path to the folder containing test files.
|
|
17
|
+
const inputPath = '../TestFiles/';
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const doc = await PDFNet.PDFDoc.create();
|
|
21
|
+
|
|
22
|
+
// ElementBuilder is used to build new Element objects
|
|
23
|
+
const eb = await PDFNet.ElementBuilder.create();
|
|
24
|
+
// ElementWriter is used to write Elements to the page
|
|
25
|
+
const writer = await PDFNet.ElementWriter.create();
|
|
26
|
+
|
|
27
|
+
let element;
|
|
28
|
+
let gstate;
|
|
29
|
+
|
|
30
|
+
// Start a new page ------------------------------------
|
|
31
|
+
|
|
32
|
+
const pageRect = await PDFNet.Rect.init(0, 0, 612, 794);
|
|
33
|
+
let page = await doc.pageCreate(pageRect);
|
|
34
|
+
|
|
35
|
+
// begin writing to the page
|
|
36
|
+
writer.beginOnPage(page);
|
|
37
|
+
|
|
38
|
+
// Create an Image that can be reused in the document or on the same page.
|
|
39
|
+
const img = await PDFNet.Image.createFromFile(doc, inputPath + 'peppers.jpg');
|
|
40
|
+
|
|
41
|
+
element = await eb.createImageFromMatrix(img, await PDFNet.Matrix2D.create((await img.getImageWidth()) / 2, -145, 20, (await img.getImageHeight()) / 2, 200, 150));
|
|
42
|
+
writer.writePlacedElement(element);
|
|
43
|
+
|
|
44
|
+
// use the same image (just change its matrix)
|
|
45
|
+
gstate = await element.getGState();
|
|
46
|
+
gstate.setTransform(200, 0, 0, 300, 50, 450);
|
|
47
|
+
writer.writePlacedElement(element);
|
|
48
|
+
|
|
49
|
+
// use the same image again (just change its matrix).
|
|
50
|
+
writer.writePlacedElement(await eb.createImageScaled(img, 300, 600, 200, -150));
|
|
51
|
+
|
|
52
|
+
writer.end(); // save changes to the current page
|
|
53
|
+
doc.pagePushBack(page);
|
|
54
|
+
|
|
55
|
+
// Start a new page ------------------------------------
|
|
56
|
+
// Construct and draw a path object using different styles
|
|
57
|
+
page = await doc.pageCreate(pageRect);
|
|
58
|
+
|
|
59
|
+
// begin writing to this page
|
|
60
|
+
writer.beginOnPage(page);
|
|
61
|
+
// Reset the GState to default
|
|
62
|
+
eb.reset();
|
|
63
|
+
|
|
64
|
+
// start constructing the path
|
|
65
|
+
eb.pathBegin();
|
|
66
|
+
eb.moveTo(306, 396);
|
|
67
|
+
eb.curveTo(681, 771, 399.75, 864.75, 306, 771);
|
|
68
|
+
eb.curveTo(212.25, 864.75, -69, 771, 306, 396);
|
|
69
|
+
eb.closePath();
|
|
70
|
+
// the path is now finished
|
|
71
|
+
element = await eb.pathEnd();
|
|
72
|
+
// the path should be filled
|
|
73
|
+
element.setPathFill(true);
|
|
74
|
+
|
|
75
|
+
// Set the path color space and color
|
|
76
|
+
gstate = await element.getGState();
|
|
77
|
+
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceCMYK());
|
|
78
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0, 0)); // cyan
|
|
79
|
+
gstate.setTransform(0.5, 0, 0, 0.5, -20, 300);
|
|
80
|
+
writer.writePlacedElement(element);
|
|
81
|
+
|
|
82
|
+
// Draw the same path using a different stroke color
|
|
83
|
+
// this path is should be filled and stroked
|
|
84
|
+
element.setPathStroke(true);
|
|
85
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 0, 1, 0)); // yellow
|
|
86
|
+
gstate.setStrokeColorSpace(await PDFNet.ColorSpace.createDeviceRGB());
|
|
87
|
+
gstate.setStrokeColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0)); // red
|
|
88
|
+
gstate.setTransform(0.5, 0, 0, 0.5, 280, 300);
|
|
89
|
+
gstate.setLineWidth(20);
|
|
90
|
+
writer.writePlacedElement(element);
|
|
91
|
+
|
|
92
|
+
// Draw the same path with with a given dash pattern
|
|
93
|
+
// this path is should be only stroked
|
|
94
|
+
element.setPathFill(false);
|
|
95
|
+
gstate.setStrokeColorWithColorPt(await PDFNet.ColorPt.init(0, 0, 1)); // blue
|
|
96
|
+
gstate.setTransform(0.5, 0, 0, 0.5, 280, 0);
|
|
97
|
+
const dashPattern = [];
|
|
98
|
+
dashPattern.push(30);
|
|
99
|
+
gstate.setDashPattern(dashPattern, 0);
|
|
100
|
+
writer.writePlacedElement(element);
|
|
101
|
+
|
|
102
|
+
// Use the path as a clipping path
|
|
103
|
+
// Save the graphics state
|
|
104
|
+
writer.writeElement(await eb.createGroupBegin());
|
|
105
|
+
// Start constructing the new path (the old path was lost when we created
|
|
106
|
+
// a new Element using CreateGroupBegin()).
|
|
107
|
+
eb.pathBegin();
|
|
108
|
+
eb.moveTo(306, 396);
|
|
109
|
+
eb.curveTo(681, 771, 399.75, 864.75, 306, 771);
|
|
110
|
+
eb.curveTo(212.25, 864.75, -69, 771, 306, 396);
|
|
111
|
+
eb.closePath();
|
|
112
|
+
// path is now constructed
|
|
113
|
+
element = await eb.pathEnd();
|
|
114
|
+
// this path is a clipping path
|
|
115
|
+
element.setPathClip(true);
|
|
116
|
+
// this path should be filled and stroked
|
|
117
|
+
element.setPathStroke(true);
|
|
118
|
+
gstate = await element.getGState();
|
|
119
|
+
gstate.setTransform(0.5, 0, 0, 0.5, -20, 0);
|
|
120
|
+
|
|
121
|
+
writer.writeElement(element);
|
|
122
|
+
|
|
123
|
+
writer.writeElement(await eb.createImageScaled(img, 100, 300, 400, 600));
|
|
124
|
+
|
|
125
|
+
// Restore the graphics state
|
|
126
|
+
writer.writeElement(await eb.createGroupEnd());
|
|
127
|
+
|
|
128
|
+
writer.end(); // save changes to the current page
|
|
129
|
+
doc.pagePushBack(page);
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
// Start a new page ------------------------------------
|
|
133
|
+
page = await doc.pageCreate(pageRect);
|
|
134
|
+
|
|
135
|
+
// begin writing to this page
|
|
136
|
+
writer.beginOnPage(page);
|
|
137
|
+
// Reset the GState to default
|
|
138
|
+
eb.reset();
|
|
139
|
+
|
|
140
|
+
// Begin writing a block of text
|
|
141
|
+
element = await eb.createTextBeginWithFont(await PDFNet.Font.create(doc, PDFNet.Font.StandardType1Font.e_times_roman), 12);
|
|
142
|
+
writer.writeElement(element);
|
|
143
|
+
|
|
144
|
+
element = await eb.createNewTextRun('Hello World!');
|
|
145
|
+
element.setTextMatrixEntries(10, 0, 0, 10, 0, 600);
|
|
146
|
+
gstate = await element.getGState();
|
|
147
|
+
// Set the spacing between lines
|
|
148
|
+
gstate.setLeading(15);
|
|
149
|
+
writer.writeElement(element);
|
|
150
|
+
|
|
151
|
+
writer.writeElement(await eb.createTextNewLine()); // New line
|
|
152
|
+
|
|
153
|
+
element = await eb.createNewTextRun('Hello World!');
|
|
154
|
+
gstate = await element.getGState();
|
|
155
|
+
gstate.setTextRenderMode(PDFNet.GState.TextRenderingMode.e_stroke_text);
|
|
156
|
+
gstate.setCharSpacing(-1.25);
|
|
157
|
+
gstate.setWordSpacing(-1.25);
|
|
158
|
+
writer.writeElement(element);
|
|
159
|
+
|
|
160
|
+
writer.writeElement(await eb.createTextNewLine()); // New line
|
|
161
|
+
|
|
162
|
+
element = await eb.createNewTextRun('Hello World!');
|
|
163
|
+
gstate = await element.getGState();
|
|
164
|
+
gstate.setCharSpacing(0);
|
|
165
|
+
gstate.setWordSpacing(0);
|
|
166
|
+
gstate.setLineWidth(3);
|
|
167
|
+
gstate.setTextRenderMode(PDFNet.GState.TextRenderingMode.e_fill_stroke_text);
|
|
168
|
+
gstate.setStrokeColorSpace(await PDFNet.ColorSpace.createDeviceRGB());
|
|
169
|
+
gstate.setStrokeColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0)); // red
|
|
170
|
+
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceCMYK());
|
|
171
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0, 0)); // cyan
|
|
172
|
+
writer.writeElement(element);
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
writer.writeElement(await eb.createTextNewLine()); // New line
|
|
176
|
+
|
|
177
|
+
// Set text as a clipping path to the image.
|
|
178
|
+
element = await eb.createNewTextRun('Hello World!');
|
|
179
|
+
gstate = await element.getGState();
|
|
180
|
+
gstate.setTextRenderMode(PDFNet.GState.TextRenderingMode.e_clip_text);
|
|
181
|
+
writer.writeElement(element);
|
|
182
|
+
|
|
183
|
+
// Finish the block of text
|
|
184
|
+
writer.writeElement(await eb.createTextEnd());
|
|
185
|
+
|
|
186
|
+
// Draw an image that will be clipped by the above text
|
|
187
|
+
writer.writeElement(await eb.createImageScaled(img, 10, 100, 1300, 720));
|
|
188
|
+
|
|
189
|
+
writer.end(); // save changes to the current page
|
|
190
|
+
doc.pagePushBack(page);
|
|
191
|
+
|
|
192
|
+
// Start a new page ------------------------------------
|
|
193
|
+
//
|
|
194
|
+
// The example illustrates how to embed the external font in a PDF document.
|
|
195
|
+
// The example also shows how ElementReader can be used to copy and modify
|
|
196
|
+
// Elements between pages.
|
|
197
|
+
|
|
198
|
+
const reader = await PDFNet.ElementReader.create();
|
|
199
|
+
|
|
200
|
+
// Start reading Elements from the last page. We will copy all Elements to
|
|
201
|
+
// a new page but will modify the font associated with text.
|
|
202
|
+
reader.beginOnPage(await doc.getPage(await doc.getPageCount()));
|
|
203
|
+
|
|
204
|
+
page = await doc.pageCreate(await PDFNet.Rect.init(0, 0, 1300, 794));
|
|
205
|
+
|
|
206
|
+
// begin writing to this page
|
|
207
|
+
writer.beginOnPage(page);
|
|
208
|
+
// Reset the GState to default
|
|
209
|
+
eb.reset();
|
|
210
|
+
|
|
211
|
+
const font = await PDFNet.Font.createTrueTypeFont(doc, inputPath + 'font.ttf');
|
|
212
|
+
|
|
213
|
+
// Read page contents
|
|
214
|
+
while ((element = await reader.next())) {
|
|
215
|
+
if ((await element.getType()) === PDFNet.Element.Type.e_text) {
|
|
216
|
+
(await element.getGState()).setFont(font, 12);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
writer.writeElement(element);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
reader.end();
|
|
223
|
+
writer.end(); // save changes to the current page
|
|
224
|
+
|
|
225
|
+
doc.pagePushBack(page);
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
// Start a new page ------------------------------------
|
|
229
|
+
//
|
|
230
|
+
// The example also shows how ElementReader can be used to copy and modify
|
|
231
|
+
// Elements between pages.
|
|
232
|
+
|
|
233
|
+
// Start reading Elements from the last page. We will copy all Elements to
|
|
234
|
+
// a new page but will modify the font associated with text.
|
|
235
|
+
reader.beginOnPage(await doc.getPage(await doc.getPageCount()));
|
|
236
|
+
|
|
237
|
+
page = await doc.pageCreate(await PDFNet.Rect.init(0, 0, 1300, 794));
|
|
238
|
+
|
|
239
|
+
// begin writing to this page
|
|
240
|
+
writer.beginOnPage(page);
|
|
241
|
+
// Reset the GState to default
|
|
242
|
+
eb.reset();
|
|
243
|
+
|
|
244
|
+
// Embed an external font in the document.
|
|
245
|
+
const font2 = await PDFNet.Font.createType1Font(doc, inputPath + 'Misc-Fixed.pfa');
|
|
246
|
+
|
|
247
|
+
// Read page contents
|
|
248
|
+
while ((element = await reader.next())) {
|
|
249
|
+
if ((await element.getType()) === PDFNet.Element.Type.e_text) {
|
|
250
|
+
(await element.getGState()).setFont(font2, 12);
|
|
251
|
+
}
|
|
252
|
+
writer.writeElement(element);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
reader.end();
|
|
256
|
+
writer.end(); // save changes to the current page
|
|
257
|
+
doc.pagePushBack(page);
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
// Start a new page ------------------------------------
|
|
261
|
+
page = await doc.pageCreate();
|
|
262
|
+
// begin writing to this page
|
|
263
|
+
writer.beginOnPage(page);
|
|
264
|
+
// Reset the GState to default
|
|
265
|
+
eb.reset();
|
|
266
|
+
|
|
267
|
+
// Begin writing a block of text
|
|
268
|
+
element = await eb.createTextBeginWithFont(await PDFNet.Font.create(doc, PDFNet.Font.StandardType1Font.e_times_roman), 12);
|
|
269
|
+
element.setTextMatrixEntries(1.5, 0, 0, 1.5, 50, 600);
|
|
270
|
+
// Set the spacing between lines
|
|
271
|
+
(await element.getGState()).setLeading(15);
|
|
272
|
+
writer.writeElement(element);
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
const para = 'A PDF text object consists of operators that can show '
|
|
276
|
+
+ 'text strings, move the text position, and set text state and certain '
|
|
277
|
+
+ 'other parameters. In addition, there are three parameters that are '
|
|
278
|
+
+ 'defined only within a text object and do not persist from one text '
|
|
279
|
+
+ 'object to the next: Tm, the text matrix, Tlm, the text line matrix, '
|
|
280
|
+
+ 'Trm, the text rendering matrix, actually just an intermediate result '
|
|
281
|
+
+ 'that combines the effects of text state parameters, the text matrix '
|
|
282
|
+
+ '(Tm), and the current transformation matrix';
|
|
283
|
+
|
|
284
|
+
const paraEnd = para.length;
|
|
285
|
+
let textRun = 0;
|
|
286
|
+
let textRunEnd;
|
|
287
|
+
|
|
288
|
+
const paraWidth = 300; // paragraph width is 300 units
|
|
289
|
+
let curWidth = 0;
|
|
290
|
+
|
|
291
|
+
while (textRun < paraEnd) {
|
|
292
|
+
textRunEnd = para.indexOf(' ', textRun);
|
|
293
|
+
if (textRunEnd < 0) {
|
|
294
|
+
textRunEnd = paraEnd - 1;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
let text = para.substring(textRun, textRunEnd + 1);
|
|
298
|
+
element = await eb.createNewTextRun(text);
|
|
299
|
+
if (curWidth + (await element.getTextLength()) < paraWidth) {
|
|
300
|
+
curWidth += await element.getTextLength();
|
|
301
|
+
} else {
|
|
302
|
+
writer.writeElement(await eb.createTextNewLine()); // New line
|
|
303
|
+
element = await eb.createNewTextRun(text);
|
|
304
|
+
curWidth = await element.getTextLength();
|
|
305
|
+
}
|
|
306
|
+
writer.writeElement(element);
|
|
307
|
+
|
|
308
|
+
textRun = textRunEnd + 1;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// -----------------------------------------------------------------------
|
|
312
|
+
// The following code snippet illustrates how to adjust spacing between
|
|
313
|
+
// characters (text runs).
|
|
314
|
+
element = await eb.createTextNewLine();
|
|
315
|
+
writer.writeElement(element); // Skip 2 lines
|
|
316
|
+
writer.writeElement(element);
|
|
317
|
+
|
|
318
|
+
writer.writeElement(await eb.createNewTextRun('An example of space adjustments between inter-characters:'));
|
|
319
|
+
writer.writeElement(await eb.createTextNewLine());
|
|
320
|
+
|
|
321
|
+
// Write string "AWAY" without space adjustments between characters.
|
|
322
|
+
element = await eb.createNewTextRun('AWAY');
|
|
323
|
+
writer.writeElement(element);
|
|
324
|
+
|
|
325
|
+
writer.writeElement(await eb.createTextNewLine());
|
|
326
|
+
|
|
327
|
+
// Write string "AWAY" with space adjustments between characters.
|
|
328
|
+
element = await eb.createNewTextRun('A');
|
|
329
|
+
writer.writeElement(element);
|
|
330
|
+
|
|
331
|
+
element = await eb.createNewTextRun('W');
|
|
332
|
+
element.setPosAdjustment(140);
|
|
333
|
+
writer.writeElement(element);
|
|
334
|
+
|
|
335
|
+
element = await eb.createNewTextRun('A');
|
|
336
|
+
element.setPosAdjustment(140);
|
|
337
|
+
writer.writeElement(element);
|
|
338
|
+
|
|
339
|
+
element = await eb.createNewTextRun('Y again');
|
|
340
|
+
element.setPosAdjustment(115);
|
|
341
|
+
writer.writeElement(element);
|
|
342
|
+
|
|
343
|
+
// Draw the same strings using direct content output...
|
|
344
|
+
writer.flush(); // flush pending Element writing operations.
|
|
345
|
+
|
|
346
|
+
// You can also write page content directly to the content stream using
|
|
347
|
+
// ElementWriter.WriteString(...) and ElementWriter.WriteBuffer(...) methods.
|
|
348
|
+
// Note that if you are planning to use these functions you need to be familiar
|
|
349
|
+
// with PDF page content operators (see Appendix A in PDF Reference Manual).
|
|
350
|
+
// Because it is easy to make mistakes during direct output we recommend that
|
|
351
|
+
// you use ElementBuilder and Element interface instead.
|
|
352
|
+
|
|
353
|
+
writer.writeString('T* T* '); // Skip 2 lines
|
|
354
|
+
writer.writeString('(Direct output to PDF page content stream:) Tj T* ');
|
|
355
|
+
writer.writeString('(AWAY) Tj T* ');
|
|
356
|
+
writer.writeString('[(A)140(W)140(A)115(Y again)] TJ ');
|
|
357
|
+
|
|
358
|
+
// Finish the block of text
|
|
359
|
+
writer.writeElement(await eb.createTextEnd());
|
|
360
|
+
|
|
361
|
+
writer.end(); // save changes to the current page
|
|
362
|
+
doc.pagePushBack(page);
|
|
363
|
+
|
|
364
|
+
// Start a new page ------------------------------------
|
|
365
|
+
|
|
366
|
+
// Image Masks
|
|
367
|
+
//
|
|
368
|
+
// In the opaque imaging model, images mark all areas they occupy on the page as
|
|
369
|
+
// if with opaque paint. All portions of the image, whether black, white, gray,
|
|
370
|
+
// or color, completely obscure any marks that may previously have existed in the
|
|
371
|
+
// same place on the page.
|
|
372
|
+
// In the graphic arts industry and page layout applications, however, it is common
|
|
373
|
+
// to crop or 'mask out' the background of an image and then place the masked image
|
|
374
|
+
// on a different background, allowing the existing background to show through the
|
|
375
|
+
// masked areas. This sample illustrates how to use image masks.
|
|
376
|
+
|
|
377
|
+
page = await doc.pageCreate();
|
|
378
|
+
// begin writing to the page
|
|
379
|
+
writer.beginOnPage(page);
|
|
380
|
+
|
|
381
|
+
// Create the Image Mask
|
|
382
|
+
const embedFile = await PDFNet.Filter.createMappedFileFromUString(inputPath + 'imagemask.dat');
|
|
383
|
+
const maskRead = await PDFNet.FilterReader.create(embedFile);
|
|
384
|
+
|
|
385
|
+
const deviceGray = await PDFNet.ColorSpace.createDeviceGray();
|
|
386
|
+
const mask = await PDFNet.Image.createDirectFromStream(doc, maskRead, 64, 64, 1, deviceGray, PDFNet.Image.InputFilter.e_ascii_hex);
|
|
387
|
+
|
|
388
|
+
(await mask.getSDFObj()).putBool('ImageMask', true);
|
|
389
|
+
|
|
390
|
+
element = await eb.createRect(0, 0, 612, 794);
|
|
391
|
+
element.setPathStroke(false);
|
|
392
|
+
element.setPathFill(true);
|
|
393
|
+
gstate = await element.getGState();
|
|
394
|
+
|
|
395
|
+
gstate.setFillColorSpace(deviceGray);
|
|
396
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0.8));
|
|
397
|
+
writer.writePlacedElement(element);
|
|
398
|
+
|
|
399
|
+
element = await eb.createImageFromMatrix(mask, await PDFNet.Matrix2D.create(200, 0, 0, -200, 40, 680));
|
|
400
|
+
(await element.getGState()).setFillColorWithColorPt(await PDFNet.ColorPt.init(0.1));
|
|
401
|
+
writer.writePlacedElement(element);
|
|
402
|
+
|
|
403
|
+
gstate = await element.getGState();
|
|
404
|
+
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceRGB());
|
|
405
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0));
|
|
406
|
+
element = await eb.createImageFromMatrix(mask, await PDFNet.Matrix2D.create(200, 0, 0, -200, 320, 680));
|
|
407
|
+
writer.writePlacedElement(element);
|
|
408
|
+
|
|
409
|
+
(await element.getGState()).setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 1, 0));
|
|
410
|
+
element = await eb.createImageFromMatrix(mask, await PDFNet.Matrix2D.create(200, 0, 0, -200, 40, 380));
|
|
411
|
+
writer.writePlacedElement(element);
|
|
412
|
+
|
|
413
|
+
{
|
|
414
|
+
// This sample illustrates Explicit Masking.
|
|
415
|
+
const img = await PDFNet.Image.createFromFile(doc, (inputPath + 'peppers.jpg'));
|
|
416
|
+
|
|
417
|
+
// mask is the explicit mask for the primary (base) image
|
|
418
|
+
img.setMask(mask);
|
|
419
|
+
|
|
420
|
+
element = await eb.createImageFromMatrix(img, await PDFNet.Matrix2D.create(200, 0, 0, -200, 320, 380));
|
|
421
|
+
writer.writePlacedElement(element);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
writer.end(); // save changes to the current page
|
|
425
|
+
doc.pagePushBack(page);
|
|
426
|
+
|
|
427
|
+
// Transparency sample ----------------------------------
|
|
428
|
+
|
|
429
|
+
// Start a new page -------------------------------------
|
|
430
|
+
page = await doc.pageCreate();
|
|
431
|
+
// begin writing to this page
|
|
432
|
+
writer.beginOnPage(page);
|
|
433
|
+
// Reset the GState to default
|
|
434
|
+
eb.reset();
|
|
435
|
+
|
|
436
|
+
// Write some transparent text at the bottom of the page.
|
|
437
|
+
element = await eb.createTextBeginWithFont(await PDFNet.Font.create(doc, PDFNet.Font.StandardType1Font.e_times_roman), 100);
|
|
438
|
+
|
|
439
|
+
// Set the text knockout attribute. Text knockout must be set outside of
|
|
440
|
+
// the text group.
|
|
441
|
+
gstate = await element.getGState();
|
|
442
|
+
gstate.setTextKnockout(false);
|
|
443
|
+
gstate.setBlendMode(PDFNet.GState.BlendMode.e_bl_difference);
|
|
444
|
+
writer.writeElement(element);
|
|
445
|
+
|
|
446
|
+
element = await eb.createNewTextRun('Transparency');
|
|
447
|
+
element.setTextMatrixEntries(1, 0, 0, 1, 30, 30);
|
|
448
|
+
gstate = await element.getGState();
|
|
449
|
+
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceCMYK());
|
|
450
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0, 0));
|
|
451
|
+
|
|
452
|
+
gstate.setFillOpacity(0.5);
|
|
453
|
+
writer.writeElement(element);
|
|
454
|
+
|
|
455
|
+
// Write the same text on top the old; shifted by 3 points
|
|
456
|
+
element.setTextMatrixEntries(1, 0, 0, 1, 33, 33);
|
|
457
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 1, 0, 0));
|
|
458
|
+
gstate.setFillOpacity(0.5);
|
|
459
|
+
|
|
460
|
+
writer.writeElement(element);
|
|
461
|
+
writer.writeElement(await eb.createTextEnd());
|
|
462
|
+
|
|
463
|
+
// Draw three overlapping transparent circles.
|
|
464
|
+
// start constructing the path
|
|
465
|
+
eb.pathBegin();
|
|
466
|
+
eb.moveTo(459.223, 505.646);
|
|
467
|
+
eb.curveTo(459.223, 415.841, 389.85, 343.04, 304.273, 343.04);
|
|
468
|
+
eb.curveTo(218.697, 343.04, 149.324, 415.841, 149.324, 505.646);
|
|
469
|
+
eb.curveTo(149.324, 595.45, 218.697, 668.25, 304.273, 668.25);
|
|
470
|
+
eb.curveTo(389.85, 668.25, 459.223, 595.45, 459.223, 505.646);
|
|
471
|
+
element = await eb.pathEnd();
|
|
472
|
+
element.setPathFill(true);
|
|
473
|
+
|
|
474
|
+
gstate = await element.getGState();
|
|
475
|
+
gstate.setFillColorSpace(await PDFNet.ColorSpace.createDeviceRGB());
|
|
476
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 0, 1)); // Blue Circle
|
|
477
|
+
|
|
478
|
+
gstate.setBlendMode(PDFNet.GState.BlendMode.e_bl_normal);
|
|
479
|
+
gstate.setFillOpacity(0.5);
|
|
480
|
+
writer.writeElement(element);
|
|
481
|
+
|
|
482
|
+
// Translate relative to the Blue Circle
|
|
483
|
+
gstate.setTransform(1, 0, 0, 1, 113, -185);
|
|
484
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(0, 1, 0)); // Green Circle
|
|
485
|
+
gstate.setFillOpacity(0.5);
|
|
486
|
+
writer.writeElement(element);
|
|
487
|
+
|
|
488
|
+
// Translate relative to the Green Circle
|
|
489
|
+
gstate.setTransform(1, 0, 0, 1, -220, 0);
|
|
490
|
+
gstate.setFillColorWithColorPt(await PDFNet.ColorPt.init(1, 0, 0)); // Red Circle
|
|
491
|
+
gstate.setFillOpacity(0.5);
|
|
492
|
+
writer.writeElement(element);
|
|
493
|
+
|
|
494
|
+
writer.end(); // save changes to the current page
|
|
495
|
+
doc.pagePushBack(page);
|
|
496
|
+
|
|
497
|
+
// End page ------------------------------------
|
|
498
|
+
|
|
499
|
+
await doc.save('../TestFiles/Output/element_builder.pdf', PDFNet.SDFDoc.SaveOptions.e_remove_unused);
|
|
500
|
+
|
|
501
|
+
console.log('Done. Result saved in element_builder.pdf...');
|
|
502
|
+
} catch (e) {
|
|
503
|
+
console.log(e);
|
|
504
|
+
ret = 1;
|
|
505
|
+
}
|
|
506
|
+
return ret;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function(error){console.log('Error: ' + JSON.stringify(error));}).then(function(){return PDFNet.shutdown();});
|
|
510
|
+
};
|
|
511
|
+
exports.runElementBuilderTest();
|
|
512
|
+
})(exports);
|
|
513
|
+
// eslint-disable-next-line spaced-comment
|
|
514
514
|
//# sourceURL=ElementBuilderTest.js
|