WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 23e8a09

Browse files
Merge branch 'development' into 996394-AnnotationRevamp
2 parents ba31884 + 45540d4 commit 23e8a09

File tree

10 files changed

+84
-318
lines changed

10 files changed

+84
-318
lines changed

Document-Processing/PDF/PDF-Library/javascript/Annotations.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ N> Setting `document.flatten = true;` flattens all interactive elements in the P
13011301

13021302
## Importing annotations
13031303

1304-
This example demonstrates how to import annotations into a PDF document using the PdfDocument. `importAnnotations` method. The DataFormat enum specifies the format of the annotation data being imported, such as FDF, XFDF, JSON, or XML.
1304+
This example demonstrates how to import annotations into a PDF document using the `importAnnotations` method. The DataFormat enum specifies the format of the annotation data being imported, such as FDF, XFDF, JSON, or XML.
13051305

13061306
{% tabs %}
13071307
{% highlight typescript tabtitle="TypeScript" %}
@@ -1333,7 +1333,7 @@ document.destroy();
13331333

13341334
## Exporting annotations
13351335

1336-
This example demonstrates how to export annotations from a PDF document using the PdfDocument.exportAnnotations method. The DataFormat enum specifies the format of the annotation data being exported, such as FDF, XFDF, JSON, or XML.
1336+
This example demonstrates how to export annotations from a PDF document using the `exportAnnotations` method. The DataFormat enum specifies the format of the annotation data being exported, such as FDF, XFDF, JSON, or XML.
13371337

13381338
{% tabs %}
13391339
{% highlight typescript tabtitle="TypeScript" %}
@@ -1345,7 +1345,7 @@ let document: PdfDocument = new PdfDocument(data);
13451345
let settings: PdfAnnotationExportSettings = new PdfAnnotationExportSettings();
13461346
settings.dataFormat = DataFormat.json;
13471347
// Export annotations to JSON format
1348-
let jsonData = document.exportAnnotations('annotations.json', settings);
1348+
document.exportAnnotations('annotations.json', settings);
13491349
// Destroy the document
13501350
document.destroy();
13511351

@@ -1357,7 +1357,7 @@ var document = new ej.pdf.PdfDocument(data);
13571357
var settings = new ej.pdf.PdfAnnotationExportSettings();
13581358
settings.dataFormat = ej.pdf.DataFormat.json;
13591359
// Export annotations to JSON format
1360-
var jsonData = document.exportAnnotations('annotations.json', settings);
1360+
document.exportAnnotations('annotations.json', settings);
13611361
// Close the document
13621362
document.destroy();
13631363

Document-Processing/PDF/PDF-Library/javascript/Bookmarks.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ let page: PdfPage = document.addPage();
2525
let bookmarks: PdfBookmarkBase = document.bookmarks;
2626
// Add a new bookmark to the PDF document
2727
let bookmark: PdfBookmark = bookmarks.add('Introduction', 0, {
28-
destination: new PdfDestination(page, { x: 100, y: 100 }, { zoom: 1 }),
29-
namedDestination: new PdfNamedDestination('First', new PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
30-
color: { r: 0, g: 0, b: 255 },
31-
textStyle: PdfTextStyle.bold});
28+
destination: new PdfDestination(page, { x: 100, y: 100 }, { zoom: 1 }),
29+
namedDestination: new PdfNamedDestination('First', new PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
30+
color: { r: 0, g: 0, b: 255 },
31+
textStyle: PdfTextStyle.bold});
3232
// Save the document
3333
document.save('output.pdf');
3434
// Close the document
@@ -45,10 +45,10 @@ var page = document.addPage();
4545
var bookmarks = document.bookmarks;
4646
// Add a new bookmark to the PDF document
4747
var bookmark = bookmarks.add('Introduction', 0, {
48-
destination: new ej.pdf.PdfDestination(page, { x: 100, y: 100 }, { zoom: 1 }),
49-
namedDestination: new ej.pdf.PdfNamedDestination('First', new ej.pdf.PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
50-
color: { r: 0, g: 0, b: 255 },
51-
textStyle: ej.pdf.PdfTextStyle.bold});
48+
destination: new ej.pdf.PdfDestination(page, { x: 100, y: 100 }, { zoom: 1 }),
49+
namedDestination: new ej.pdf.PdfNamedDestination('First', new ej.pdf.PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
50+
color: { r: 0, g: 0, b: 255 },
51+
textStyle: ej.pdf.PdfTextStyle.bold});
5252
// Save the document
5353
document.save('output.pdf');
5454
// Close the document
@@ -117,16 +117,16 @@ let page: PdfPage = document.addPage();
117117
let bookmarks: PdfBookmarkBase = document.bookmarks;
118118
// Add a new bookmark to the PDF document
119119
let bookmark: PdfBookmark = bookmarks.add('Introduction', 0, {
120-
destination: new PdfDestination(page, { x: 100, y: 100 }, { zoom: 1 }),
121-
namedDestination: new PdfNamedDestination('First', new PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
122-
color: { r: 0, g: 0, b: 255 },
123-
textStyle: PdfTextStyle.bold});
120+
destination: new PdfDestination(page, { x: 100, y: 100 }, { zoom: 1 }),
121+
namedDestination: new PdfNamedDestination('First', new PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
122+
color: { r: 0, g: 0, b: 255 },
123+
textStyle: PdfTextStyle.bold});
124124
// Add a child bookmark to the PDF document
125125
let childbookmark: PdfBookmark = bookmark.add('FirstChild', 0, {
126-
destination: new PdfDestination(page, { x: 100, y: 150 }, { zoom: 1 }),
127-
namedDestination: new PdfNamedDestination('Second', new PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
128-
color: { r: 0, g: 0, b: 255 },
129-
textStyle: PdfTextStyle.bold});
126+
destination: new PdfDestination(page, { x: 100, y: 150 }, { zoom: 1 }),
127+
namedDestination: new PdfNamedDestination('Second', new PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
128+
color: { r: 0, g: 0, b: 255 },
129+
textStyle: PdfTextStyle.bold});
130130
// Save the document
131131
document.save('output.pdf');
132132
// Close the document
@@ -143,16 +143,16 @@ var page= document.addPage();
143143
var bookmarks = document.bookmarks;
144144
// Add a new bookmark to the PDF document
145145
var bookmark = bookmarks.add('Introduction', 0, {
146-
destination: new ej.pdf.PdfDestination(page, { x: 100, y: 100 }, { zoom: 1 }),
147-
namedDestination: new ej.pdf.PdfNamedDestination('First', new ej.pdf.PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
148-
color: { r: 0, g: 0, b: 255 },
149-
textStyle: ej.pdf.PdfTextStyle.bold});
146+
destination: new ej.pdf.PdfDestination(page, { x: 100, y: 100 }, { zoom: 1 }),
147+
namedDestination: new ej.pdf.PdfNamedDestination('First', new ej.pdf.PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
148+
color: { r: 0, g: 0, b: 255 },
149+
textStyle: ej.pdf.PdfTextStyle.bold});
150150
// Add a child bookmark to the PDF document
151151
var childbookmark = bookmark.add('FirstChild', 0, {
152-
destination: new ej.pdf.PdfDestination(page, { x: 100, y: 150 }, { zoom: 1 }),
153-
namedDestination: new ej.pdf.PdfNamedDestination('Second', new ej.pdf.PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
154-
color: { r: 0, g: 0, b: 255 },
155-
textStyle: ej.pdf.PdfTextStyle.bold});
152+
destination: new ej.pdf.PdfDestination(page, { x: 100, y: 150 }, { zoom: 1 }),
153+
namedDestination: new ej.pdf.PdfNamedDestination('Second', new ej.pdf.PdfDestination(page, { x: 0, y: 10 }, {zoom: 1 })),
154+
color: { r: 0, g: 0, b: 255 },
155+
textStyle: ej.pdf.PdfTextStyle.bold});
156156
// Save the document
157157
document.save('output.pdf');
158158
// Close the document

Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-asp-net-mvc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Step 6: **Create a PDF document**: Add the script in `~/Views/Home/Index.cshtml`
5353
</div>
5454
@section Scripts {
5555
<script>
56-
document.getElementById('btnCreatePdf').addEventListener('click', function () {
56+
document.getElementById('btnCreatePdf').addEventListener('click', function () {
5757
// Create a new PDF document
5858
let pdf = new ej.pdf.PdfDocument();
5959
// Add a new page

Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-javascript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ Step 4: **Create a PDF document**: Add the script in `index.html` by creating a
5050
<button id="btnCreatePdf" class="btn btn-primary">Generate PDF document</button>
5151
</div>
5252
@section Scripts {
53-
<script>
54-
document.getElementById('btnCreatePdf').addEventListener('click', function () {
53+
<script>
54+
document.getElementById('btnCreatePdf').addEventListener('click', function () {
5555
// Create a new PDF document
5656
var pdf = new ej.pdf.PdfDocument();
5757
// Add a new page

Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-typescript.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ import { PdfDocument, PdfGraphics, PdfPage, PdfFont, PdfFontFamily, PdfFontStyle
6767
{% tabs %}
6868
{% highlight ts tabtitle="index.ts" %}
6969
document.getElementById('normalButton').onclick = (): void => {
70-
// Create a new PDF document
71-
let pdf = new PdfDocument();
72-
// Add a new page
73-
let page: PdfPage = pdf.addPage();
74-
// Get graphics from the page
75-
let graphics: PdfGraphics = page.graphics;
76-
// Set font
77-
let font: PdfFont = pdf.embedFont(PdfFontFamily.helvetica, 36, PdfFontStyle.regular);
78-
// Create a new black brush
79-
let brush = new PdfBrush({r: 0, g: 0, b: 0});
80-
// Draw text
81-
graphics.drawString('Hello World!!!', font, {x: 20, y: 20, width: graphics.clientSize.width - 20, height: 60}, brush);
82-
// Save and download PDF
83-
pdf.save('output.pdf');
84-
// Destroy the PDF document instance
85-
pdf.destroy();
70+
// Create a new PDF document
71+
let pdf = new PdfDocument();
72+
// Add a new page
73+
let page: PdfPage = pdf.addPage();
74+
// Get graphics from the page
75+
let graphics: PdfGraphics = page.graphics;
76+
// Set font
77+
let font: PdfFont = pdf.embedFont(PdfFontFamily.helvetica, 36, PdfFontStyle.regular);
78+
// Create a new black brush
79+
let brush = new PdfBrush({r: 0, g: 0, b: 0});
80+
// Draw text
81+
graphics.drawString('Hello World!!!', font, {x: 20, y: 20, width: graphics.clientSize.width - 20, height: 60}, brush);
82+
// Save and download PDF
83+
pdf.save('output.pdf');
84+
// Destroy the PDF document instance
85+
pdf.destroy();
8686
};
8787
{% endhighlight %}
8888
{% endtabs %}

Document-Processing/PDF/PDF-Library/javascript/Create-PDF-document-vue.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,22 @@ export default {
6969
name: 'App',
7070
methods: {
7171
createPdf() {
72-
73-
// Create a new PDF document
74-
const pdf = new ej.pdf.PdfDocument();
75-
// Add a new page
76-
const page: ej.pdf.PdfPage = pdf.addPage();
77-
// Get graphics from the page
78-
const graphics: ej.pdf.PdfGraphics = page.graphics;
79-
// Set font
80-
const font: ej.pdf.PdfStandardFont = pdf.embedFont(ej.pdf.PdfFontFamily.helvetica, 36, ej.pdf.PdfFontStyle.regular);
81-
// Create a new black brush
82-
const brush = new ej.pdf.PdfBrush({r: 0, g: 0, b: 0});
83-
// Draw text
84-
graphics.drawString('Hello World!!!', font, {x: 20, y: 20, width: graphics.clientSize.width - 20, height: 60}, brush);
85-
// Save and download PDF
86-
pdf.save('Output.pdf');
87-
// Destroy the PDF document instance
88-
pdf.destroy();
72+
// Create a new PDF document
73+
const pdf = new ej.pdf.PdfDocument();
74+
// Add a new page
75+
const page: ej.pdf.PdfPage = pdf.addPage();
76+
// Get graphics from the page
77+
const graphics: ej.pdf.PdfGraphics = page.graphics;
78+
// Set font
79+
const font: ej.pdf.PdfStandardFont = pdf.embedFont(ej.pdf.PdfFontFamily.helvetica, 36, ej.pdf.PdfFontStyle.regular);
80+
// Create a new black brush
81+
const brush = new ej.pdf.PdfBrush({r: 0, g: 0, b: 0});
82+
// Draw text
83+
graphics.drawString('Hello World!!!', font, {x: 20, y: 20, width: graphics.clientSize.width - 20, height: 60}, brush);
84+
// Save and download PDF
85+
pdf.save('Output.pdf');
86+
// Destroy the PDF document instance
87+
pdf.destroy();
8988

9089
}
9190
}

Document-Processing/PDF/PDF-Library/javascript/FormFields.md

Lines changed: 15 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,9 +1067,7 @@ document.destroy();
10671067

10681068
## Importing form fields data
10691069

1070-
### Importing FDF file to PDF
1071-
1072-
This example demonstrates how to import form data from an FDF file into a PDF document using the `importFormData` method. Importing FDF data allows you to populate form fields in a PDF with values from an external data source.
1070+
This example demonstrates how to import form data from an FDF file into a PDF document using the `importFormData` method. The DataFormat enum specifies the format of the annotation data being imported, such as FDF, XFDF, JSON, or XML.
10731071

10741072
{% tabs %}
10751073
{% highlight typescript tabtitle="TypeScript" %}
@@ -1083,43 +1081,14 @@ document.importFormData(fdfData, DataFormat.fdf);
10831081
document.save('Output.pdf');
10841082
// Close the document
10851083
document.destroy();
1086-
{% endhighlight %}
1087-
{% highlight javascript tabtitle="JavaScript" %}
1088-
// Load an existing PDF document
1089-
var document = new ej.pdf.PdfDocument(data);
1090-
// Imports form data into the PDF document.
1091-
document.importFormData(fdfData, ej.pdf.DataFormat.fdf);
1092-
// Save the document
1093-
document.save('Output.pdf');
1094-
// Close the document
1095-
document.destroy();
1096-
{% endhighlight %}
1097-
{% endtabs %}
1098-
1099-
### Importing XFDF file to PDF
1100-
1101-
This example demonstrates how to import form data from an XFDF file into a PDF document using the `importFormData` method. Importing XFDF data allows you to populate form fields in a PDF with values from an external data source.
1102-
1103-
{% tabs %}
1104-
{% highlight typescript tabtitle="TypeScript" %}
1105-
import {PdfDocument, DataFormat} from '@syncfusion/ej2-pdf';
1106-
1107-
// Load an existing PDF document
1108-
let document: PdfDocument = new PdfDocument(data);
1109-
// Imports form data into the PDF document.
1110-
document.importFormData(xfdfData, DataFormat.xfdf);
1111-
// Save the document
1112-
document.save('Output.pdf');
1113-
// Close the document
1114-
document.destroy();
11151084

11161085
{% endhighlight %}
11171086
{% highlight javascript tabtitle="JavaScript" %}
11181087

11191088
// Load an existing PDF document
11201089
var document = new ej.pdf.PdfDocument(data);
11211090
// Imports form data into the PDF document.
1122-
document.importFormData(xfdfData, ej.pdf.DataFormat.xfdf);
1091+
document.importFormData(fdfData, ej.pdf.DataFormat.fdf);
11231092
// Save the document
11241093
document.save('Output.pdf');
11251094
// Close the document
@@ -1130,78 +1099,34 @@ document.destroy();
11301099

11311100
## Exporting form fields data
11321101

1133-
### Export PDF file to FDF
1134-
1135-
This example demonstrates how to export form data from a PDF document to an FDF file using the `exportFormData` method. Exporting FDF data allows you to save the values of form fields in a lightweight format for reuse or integration with other systems.
1102+
This example demonstrates how to export form data from a PDF document to an FDF file using the `exportFormData` method. The DataFormat enum specifies the format of the annotation data being imported, such as FDF, XFDF, JSON, or XML.
11361103

11371104
{% tabs %}
11381105
{% highlight typescript tabtitle="TypeScript" %}
11391106
import {PdfDocument, PdfFormFieldExportSettings, DataFormat } from '@syncfusion/ej2-pdf';
11401107

11411108
// Load an existing PDF document
11421109
let document: PdfDocument = new PdfDocument(data);
1143-
// Sets the form field data export settings with output data format.
1144-
let settings: PdfFormFieldExportSettings = new PdfFormFieldExportSettings();
1145-
settings.dataFormat = DataFormat.fdf;
1146-
// Export form field to fdf format
1147-
let fdf: Uint8Array = document.exportFormData(settings);
1148-
// Save the document
1149-
document.save('Output.pdf');
1150-
// Close the document
1151-
document.destroy();
1152-
1153-
{% endhighlight %}
1154-
{% highlight javascript tabtitle="JavaScript" %}
1155-
1156-
// Load an existing PDF document
1157-
var document = new ej.pdf.PdfDocument(data);
1158-
// Sets the form field data export settings with output data format.
1159-
var settings = new ej.pdf.PdfFormFieldExportSettings();
1160-
settings.dataFormat = ej.pdf.DataFormat.fdf;
1161-
// Export form field to fdf format
1162-
var fdf = document.exportFormData(settings);
1163-
// Save the document
1164-
document.save('Output.pdf');
1165-
// Close the document
1166-
document.destroy();
1167-
1168-
{% endhighlight %}
1169-
{% endtabs %}
1170-
1171-
### Export PDF file to XFDF
1172-
1173-
This example demonstrates how to export form data from a PDF document to an XFDF file using the `exportFormData` method. Exporting XFDF data allows you to save the values of form fields in a lightweight format for reuse or integration with other systems.
1174-
1175-
{% tabs %}
1176-
{% highlight typescript tabtitle="TypeScript" %}
1177-
import {PdfDocument, PdfFormFieldExportSettings, DataFormat } from '@syncfusion/ej2-pdf';
1178-
1179-
// Load an existing PDF document
1180-
let document: PdfDocument = new PdfDocument(data);
1181-
// Sets the form field data export settings with output data format.
1110+
// Sets the form field data export settings with output data format
11821111
let settings: PdfFormFieldExportSettings = new PdfFormFieldExportSettings();
1183-
settings.dataFormat = DataFormat.xfdf;
1184-
// Export form field to XFDF format
1185-
let xfdf: Uint8Array = document.exportFormData(settings);
1186-
// Save the document
1187-
document.save('Output.pdf');
1188-
// Close the document
1189-
document.destroy();
1112+
settings.dataFormat = DataFormat.json;
1113+
// Export form field to JSON format
1114+
document.exportFormData('formData.json', settings);
1115+
// Destroy the document
1116+
document. Destroy();
11901117

11911118
{% endhighlight %}
11921119
{% highlight javascript tabtitle="JavaScript" %}
11931120

11941121
// Load an existing PDF document
11951122
var document = new ej.pdf.PdfDocument(data);
1196-
// Sets the form field data export settings with output data format.
1123+
// Sets the form field data export settings with output data format
11971124
var settings = new ej.pdf.PdfFormFieldExportSettings();
1198-
settings.dataFormat = ej.pdf.DataFormat.xfdf;
1199-
// Export form field to XFDF format
1200-
var xfdf = document.exportFormData(settings);
1201-
// Save the document
1202-
document.save('Output.pdf');
1203-
// Close the document
1204-
document.destroy();
1125+
settings.dataFormat = ej.pdf.DataFormat.json;
1126+
// Export form field to JSON format
1127+
document.exportFormData('formData.json', settings);
1128+
// Destroy the document
1129+
document. Destroy();
12051130

12061131
{% endhighlight %}
12071132
{% endtabs %}

0 commit comments

Comments
 (0)