You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Working with EJ2 PDF templates | Syncfusion
3
-
description: This section explains how to create a PDF template is a drawing surface, where contents can be added using EJ2 PDF library.
2
+
title: Working with PDF file templates | Syncfusion
3
+
description: This section explains how to create a PDF template is a drawing surface, where contents can be added using PDF library.
4
4
platform: document-processing
5
5
control: PDF
6
6
documentation: UG
7
7
---
8
-
# Working with EJ2 PDF Templates
8
+
# Working with PDF Templates
9
9
10
-
A EJ2 PDF template is a drawing surface, where contents can be added. All the elements that can be added to a PdfPage is supported in PdfTemplate as well. The template in turn can be drawn over the page or can be positioned at any part of the page.
10
+
A PDF template is a drawing surface, where contents can be added. All the elements that can be added to a PdfPage is supported in PdfTemplate as well. The template in turn can be drawn over the page or can be positioned at any part of the page.
11
11
12
12
## Creating a new PDF template
13
13
14
14
This example demonstrates how to create a new PDF template using the `PdfTemplate` class. A PDF template allows you to define reusable graphics or content that can be drawn on multiple pages or annotations within a PDF document.
This example demonstrates how to create templates from an existing PDF document using the `PdfTemplate` class. A PDF template allows you to extract and reuse content from a PDF page or annotation, enabling consistent design and repeated elements across multiple pages.
description: This section explains how to Redact the content from an existing PDF document by using Essential EJ2 PDF
2
+
title: Working with Redaction |Syncfusion
3
+
description: This section explains how to Redact the content from an existing PDF document by using Essential PDF
4
4
platform: document-processing
5
5
control: PDF
6
6
documentation: UG
7
7
---
8
-
# Working with EJ2 PDF Redaction
8
+
# Working with PDF Redaction
9
9
10
-
Redacting a PDF is the process of permanently removing sensitive or confidential information from PDF documents. Syncfusion<sup>®</sup> EJ2 PDF library provides an easy way to redact PDF documents.
10
+
Redacting a PDF is the process of permanently removing sensitive or confidential information from PDF documents. Syncfusion<sup>®</sup> PDF library provides an easy way to redact PDF documents.
11
11
12
12
## Removing sensitive content from the PDF document
13
13
14
14
Redaction permanently removes confidential or sensitive information from a PDF. The `PdfRedactionAnnotation` class allows you to define areas to redact, ensuring the underlying text or image data is completely deleted from the document.
15
15
16
16
{% tabs %}
17
-
{% highlight ts tabtitle="index.ts" %}
17
+
{% highlight c# tabtitle="TypeScript" %}
18
18
19
-
// Create and render button
20
-
let button: Button = new Button();
21
-
button.appendTo('#normalbtn');
19
+
import { PdfDocument, PdfPage, PdfRedactionAnnotation } from '@syncfusion/ej2-pdf';
22
20
23
-
// Handle click event
24
-
button.element.onclick = async () => {
25
-
console.log('Start PDF Creation');
26
-
createPdf();
27
-
};
28
-
29
-
// Function to create PDF
30
-
function createPdf() {
31
21
// Load an existing PDF document
32
-
let document: PdfDocument = new PdfDocument('Input.pdf');
22
+
let document: PdfDocument = new PdfDocument(data, password);
33
23
// Access the first page
34
24
let page: PdfPage = document.getPage(0);
35
25
// Create a new redaction annotation
36
-
const annotation: PdfRedactionAnnotation = new PdfRedactionAnnotation (50, 100, 100, 50);
You can overlay custom text on the redacted region to indicate the reason for redaction or provide context. For example, adding "Confidential" or "Redacted" helps users understand why the content was removed.
58
40
59
41
{% tabs %}
60
-
{% highlight ts tabtitle="index.ts" %}
42
+
{% highlight c# tabtitle="TypeScript" %}
61
43
62
-
// Create and render button
63
-
let button: Button = new Button();
64
-
button.appendTo('#normalbtn');
44
+
import { PdfDocument, PdfPage, PdfRedactionAnnotation } from '@syncfusion/ej2-pdf';
65
45
66
-
// Handle click event
67
-
button.element.onclick = async () => {
68
-
console.log('Start PDF Creation');
69
-
createPdf();
70
-
};
71
-
72
-
// Function to create PDF
73
-
function createPdf() {
74
46
// Load an existing PDF document
75
-
let document: PdfDocument = new PdfDocument('Input.pdf');
47
+
let document: PdfDocument = new PdfDocument(data, password);
76
48
// Access the first page
77
49
let page: PdfPage = document.getPage(0);
78
50
// Create a new redaction annotation
79
51
const font: PdfFont = new PdfStandardFont(PdfFontFamily.timesRoman, 12);
You can apply a solid fill color to cover the redacted content. This is the most common approach for redaction.
103
71
104
72
{% tabs %}
105
-
{% highlight ts tabtitle="index.ts" %}
73
+
{% highlight c# tabtitle="TypeScript" %}
106
74
107
-
// Create and render button
108
-
let button: Button = new Button();
109
-
button.appendTo('#normalbtn');
75
+
import { PdfDocument, PdfPage, PdfRedactionAnnotation } from '@syncfusion/ej2-pdf';
110
76
111
-
// Handle click event
112
-
button.element.onclick = async () => {
113
-
console.log('Start PDF Creation');
114
-
createPdf();
115
-
};
116
-
117
-
// Function to create PDF
118
-
function createPdf() {
119
77
// Create a new PDF document
120
78
let document: PdfDocument = new PdfDocument();
121
79
// Add a new section to the document
@@ -154,13 +112,6 @@ function createPdf() {
154
112
document.save('Output.pdf');
155
113
// Close the document
156
114
document.destroy();
157
-
}
158
-
{% endhighlight %}
159
-
{% highlight html tabtitle="index.html" %}
160
-
161
-
<divclass="row">
162
-
<button id="normalbtn">Create PDF</button>
163
-
</div>
164
115
165
116
{% endhighlight %}
166
117
{% endtabs %}
@@ -170,40 +121,22 @@ function createPdf() {
170
121
Customize the appearance of the redacted area by applying specific fill colors. This helps maintain a consistent design or highlight redacted sections in a visually appealing way.
171
122
172
123
{% tabs %}
173
-
{% highlight ts tabtitle="index.ts" %}
174
-
175
-
// Create and render button
176
-
let button: Button = new Button();
177
-
button.appendTo('#normalbtn');
124
+
{% highlight c# tabtitle="TypeScript" %}
178
125
179
-
// Handle click event
180
-
button.element.onclick = async () => {
181
-
console.log('Start PDF Creation');
182
-
createPdf();
183
-
};
126
+
import { PdfDocument, PdfPage, PdfRedactionAnnotation } from '@syncfusion/ej2-pdf';
184
127
185
-
// Function to create PDF
186
-
function createPdf() {
187
128
// Load an existing PDF document
188
-
let document: PdfDocument = new PdfDocument('Input.pdf');
129
+
let document: PdfDocument = new PdfDocument(data, password);
0 commit comments