Skip to content

Commit d11f009

Browse files
committed
986455-1: Modified 70 files.
1 parent cc11bd3 commit d11f009

File tree

70 files changed

+1716
-2286
lines changed
  • Security
    • Determine-whether-the-PDF-is-protected-or-not/.NET/Determine-whether-the-PDF-is-protected-or-not
    • Encrypt-PDF-with-AES-using-owner-password/.NET/Encrypt-PDF-with-AES-using-owner-password
    • Encrypt-PDF-with-AES-using-user-password/.NET/Encrypt-PDF-with-AES-using-user-password
    • Encrypt-PDF-with-RC4-using-owner-password/.NET/Encrypt-PDF-with-RC4-using-owner-password
    • Encrypt-PDF-with-RC4-using-user-password/.NET/Encrypt-PDF-with-RC4-using-user-password
    • Encrypt-all-contents-except-metadata-of-the-PDF/.NET/Encrypt-all-contents-except-metadata-of-the-PDF
    • Encrypt-all-contents-of-the-PDF-document/.NET/Encrypt-all-contents-of-the-PDF-document
    • Encrypt-only-attachment-in-the-PDF-document/.NET/Encrypt-only-attachment-in-the-PDF-document
    • Load-an-encrypt-only-attachment-document/.NET/Load-an-encrypt-only-attachment-document
    • Protect-an-existing-PDF-document/.NET/Protect-an-existing-PDF-document
    • Protect-attachments-in-existing-PDF-document/.NET/Protect-attachments-in-existing-PDF-document
    • Remove-password-from-user-password-PDF-document/.NET/Remove-password-from-user-password-PDF-document
    • Secure_data _with _AES_GCM/.NET/Secure_data _with _AES_GCM
    • Set-user-password-when-accessing-the-attachment/.NET/Set-user-password-when-accessing-the-attachment
  • Shapes
    • Dash-pattern-in-shapes/.NET/Dash-pattern-in-shapes
    • Draw-a-bazier-in-an-existing-PDF-document/.NET/Draw-a-bazier-in-an-existing-PDF-document
    • Draw-a-bazier-in-new-PDF-document/.NET/Draw-a-bazier-in-new-PDF-document
    • Draw-a-curve-in-an-existing-PDF-document/.NET/Draw-a-curve-in-an-existing-PDF-document
    • Draw-a-curve-in-new-PDF-document/.NET/Draw-a-curve-in-new-PDF-document
    • Draw-a-line-in-an-existing-PDF-document/.NET/Draw-a-line-in-an-existing-PDF-document
    • Draw-a-line-in-new-PDF-document/.NET/Draw-a-line-in-new-PDF-document
    • Draw-a-pie-in-an-existing-PDF-document/.NET/Draw-a-pie-in-an-existing-PDF-document
    • Draw-a-pie-in-new-PDF-document/.NET/Draw-a-pie-in-new-PDF-document
    • Draw-a-polygon-in-an-existing-PDF-document/.NET/Draw-a-polygon-in-an-existing-PDF-document
    • Draw-a-rectangle-in-a-new-PDF-document/.NET/Draw-a-rectangle-in-a-new-PDF-document
    • Draw-a-rectangle-in-an-existing-PDF-document/.NET/Draw-a-rectangle-in-an-existing-PDF-document
    • Draw-an-arc-in-an-existing-PDF-document/.NET/Draw-an-arc-in-an-existing-PDF-document
    • Draw-an-arc-in-new-PDF-document/.NET/Draw-an-arc-in-new-PDF-document
    • Draw-an-ellipse-in-an-existing-PDF-document/.NET/Draw-an-ellipse-in-an-existing-PDF-document
    • Draw-an-ellipse-in-new-PDF-document/.NET/Draw-an-ellipse-in-new-PDF-document
    • Draw-large-shapes-across-multiple-pages/.NET/Draw-large-shapes-across-multiple-pages
    • Draw-path-in-a-new-PDF-document/.NET/Draw-path-in-a-new-PDF-document
    • Draw-path-in-an-existing-PDF-document/.NET/Draw-path-in-an-existing-PDF-document
    • Draw-polygon-in-new-PDF-document/.NET/Draw-polygon-in-new-PDF-document
    • Multi-color-radial-gradient-fill-in-PDF/.NET/Multi-color-radial-gradient-fill-in-PDF
  • Table/PdfGrid
    • Add-column-spanning-in-a-PDF-table/.NET/Add-column-spanning-in-a-PDF-table
    • Add-different-cell-styles-to-a-cell-in-a-PDF-table/.NET/Add-different-cell-styles-to-a-cell-in-a-PDF-table
    • Add-different-font-style-for-particular-table-cell/.NET/Add-different-font-style-for-particular-table-cell
    • Add-different-styles-to-a-row-in-PDF-table/.NET/Add-different-styles-to-a-row-in-PDF-table
    • Add-multiple-tables-in-a-PDF-document/.NET/Add-multiple-tables-in-a-PDF-document
    • Add-row-spanning-in-a-PDF-table/.NET/Add-row-spanning-in-a-PDF-table
    • Add-string-formatting-for-a-cell-in-table/.NET/Add-string-formatting-for-a-cell-in-table
    • Add-string-formatting-for-a-row-in-table/.NET/Add-string-formatting-for-a-row-in-table
    • Add-string-formatting-to-a-column-in-table/.NET/Add-string-formatting-to-a-column-in-table
    • Add-the-background-image-in-a-PDF-table-cell/.NET/Add-the-background-image-in-a-PDF-table-cell
    • Add-the-data-directly-to-the-table-in-a-PDF/.NET/Add-the-data-directly-to-the-table-in-a-PDF
    • Apply-built-in-style-to-table-with-table-option/.NET/Apply-built-in-style-to-table-with-table-option
    • Apply-string-formatting-for-whole-table-in-a-PDF/.NET/Apply-string-formatting-for-whole-table-in-a-PDF
    • Apply-word-wrap-in-the-PDF-table-cell/.NET/Apply-word-wrap-in-the-PDF-table-cell
    • Applying-Customizing-Styles-in-PDF-Grid/.NET/Applying-Customizing-Styles-in-PDF-Grid
    • Automatically-adjust-the-table-width-in-a-PDF/.NET/Automatically-adjust-the-table-width-in-a-PDF
    • Cell-customization-in-PdfGrid/.NET/Cell-customization-in-PdfGrid
    • Changing-Margins-from-the-Second-Page-onwards/.NET/Changing-Margins-from-the-Second-Page-onwards
    • Column-customization-of-PdfGrid-in-a-PDF/.NET/Column-customization-of-PdfGrid-in-a-PDF
    • Create-nested-table-in-a-PDF-document/.NET/Create-nested-table-in-a-PDF-document
    • Create-table-from-data-source-in-a-PDF/.NET/Create-table-from-data-source-in-a-PDF
    • Create-table-from-list-in-a-PDF-document/.NET/Create-table-from-list-in-a-PDF-document
    • Create-table-in-an-existing-document/.NET/Create-table-in-an-existing-document
    • Create-table-with-built-in-style/.NET/Create-table-with-built-in-style
    • Customize-the-table-in-a-PDF-document/.NET/Customize-the-table-in-a-PDF-document
    • Draw-HTML-styled-text-in-a-PDF-table-cell/.NET/Draw-HTML-styled-text-in-a-PDF-table-cell
    • Draw-borderless-table-in-PDF-document/.NET/Draw-borderless-table-in-PDF-document
    • Draw-rotated-table-in-PDF-document/.NET/Draw-rotated-table-in-PDF-document
    • Insert-image-in-a-particular-table-cell/.NET/Insert-image-in-a-particular-table-cell
    • Paginate-the-table-in-PDF-document/.NET/Paginate-the-table-in-PDF-document
    • Prevent-row-breaks-across-pages/.NET/Prevent-row-breaks-across-pages
    • Resize-font-to-fit-grid-cell-width/.NET/Resize-font-to-fit-grid-cell-width
    • Row-customization-of-PdfGrid-in-a-PDF/.NET/Row-customization-of-PdfGrid-in-a-PDF
    • Set-different-margins-for-multi-page-PDF-grid/.NET/Set-different-margins-for-multi-page-PDF-grid

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1716
-2286
lines changed
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Pdf;
1+
using Syncfusion.Pdf;
42
using Syncfusion.Pdf.Parsing;
53

64
try
75
{
8-
//Get stream from an existing document.
9-
FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
10-
116
//Load the PDF document.
12-
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
7+
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(Path.GetFullPath(@"Data/Input.pdf"));
138

149
//Write whether document is protected or not in console window.
1510
Console.WriteLine("The PDF document is password protected one");
@@ -22,5 +17,4 @@
2217
Console.WriteLine("Cannot open an encrypted document without password");
2318
}
2419
}
25-
2620
Console.ReadLine();
Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,39 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Drawing;
1+
using Syncfusion.Drawing;
42
using Syncfusion.Pdf;
53
using Syncfusion.Pdf.Graphics;
64
using Syncfusion.Pdf.Security;
75

86
//Create a new PDF document.
9-
PdfDocument document = new PdfDocument();
10-
11-
//Add page to the document.
12-
PdfPage page = document.Pages.Add();
13-
14-
//Create PDF graphics for the page.
15-
PdfGraphics graphics = page.Graphics;
7+
using (PdfDocument document = new PdfDocument())
8+
{
9+
//Add page to the document.
10+
PdfPage page = document.Pages.Add();
1611

17-
//Set the font.
18-
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
12+
//Create PDF graphics for the page.
13+
PdfGraphics graphics = page.Graphics;
1914

20-
//Set the brush.
21-
PdfBrush brush = PdfBrushes.Black;
15+
//Set the font.
16+
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
2217

23-
//Document security.
24-
PdfSecurity security = document.Security;
18+
//Set the brush.
19+
PdfBrush brush = PdfBrushes.Black;
2520

26-
//Specifies key size and encryption algorithm.
27-
security.KeySize = PdfEncryptionKeySize.Key256Bit;
28-
security.Algorithm = PdfEncryptionAlgorithm.AES;
21+
//Document security.
22+
PdfSecurity security = document.Security;
2923

30-
//Set the owner password for security.
31-
security.OwnerPassword = "syncfusion";
24+
//Specifies key size and encryption algorithm.
25+
security.KeySize = PdfEncryptionKeySize.Key256Bit;
26+
security.Algorithm = PdfEncryptionAlgorithm.AES;
3227

33-
//It allows printing and accessibility copy content.
34-
security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.AccessibilityCopyContent;
35-
security.UserPassword = "password";
28+
//Set the owner password for security.
29+
security.OwnerPassword = "syncfusion";
3630

37-
//Draw the text.
38-
graphics.DrawString("This document is protected with owner password", font, brush, new PointF(0, 40));
31+
//It allows printing and accessibility copy content.
32+
security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.AccessibilityCopyContent;
33+
security.UserPassword = "password";
3934

40-
//Create file stream.
41-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
42-
{
43-
//Save the PDF document to file stream.
44-
document.Save(outputFileStream);
35+
//Draw the text.
36+
graphics.DrawString("This document is protected with owner password", font, brush, new PointF(0, 40));
37+
//Save the PDF document
38+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
4539
}
46-
47-
//Close the document.
48-
document.Close(true);
Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,34 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Drawing;
1+
using Syncfusion.Drawing;
42
using Syncfusion.Pdf;
53
using Syncfusion.Pdf.Graphics;
64
using Syncfusion.Pdf.Security;
75

86
//Create a new PDF document.
9-
PdfDocument document = new PdfDocument();
10-
11-
//Add page to the document.
12-
PdfPage page = document.Pages.Add();
7+
using (PdfDocument document = new PdfDocument())
8+
{
139

14-
//Create PDF graphics for the page.
15-
PdfGraphics graphics = page.Graphics;
10+
//Add page to the document.
11+
PdfPage page = document.Pages.Add();
1612

17-
//Set the font.
18-
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
13+
//Create PDF graphics for the page.
14+
PdfGraphics graphics = page.Graphics;
1915

20-
//Set the brush.
21-
PdfBrush brush = PdfBrushes.Black;
16+
//Set the font.
17+
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
2218

23-
//Document security.
24-
PdfSecurity security = document.Security;
19+
//Set the brush.
20+
PdfBrush brush = PdfBrushes.Black;
2521

26-
//Specifies key size and encryption algorithm.
27-
security.KeySize = PdfEncryptionKeySize.Key256Bit;
28-
security.Algorithm = PdfEncryptionAlgorithm.AES;
29-
security.UserPassword = "password";
22+
//Document security.
23+
PdfSecurity security = document.Security;
3024

31-
//Draw the text.
32-
graphics.DrawString("Encrypted with AES 256bit", font, brush, new PointF(0, 40));
25+
//Specifies key size and encryption algorithm.
26+
security.KeySize = PdfEncryptionKeySize.Key256Bit;
27+
security.Algorithm = PdfEncryptionAlgorithm.AES;
28+
security.UserPassword = "password";
3329

34-
//Create file stream.
35-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
36-
{
37-
//Save the PDF document to file stream.
38-
document.Save(outputFileStream);
30+
//Draw the text.
31+
graphics.DrawString("Encrypted with AES 256bit", font, brush, new PointF(0, 40));
32+
//Save the PDF document
33+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
3934
}
40-
41-
//Close the document.
42-
document.Close(true);
Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,36 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Drawing;
1+
using Syncfusion.Drawing;
42
using Syncfusion.Pdf;
53
using Syncfusion.Pdf.Graphics;
64
using Syncfusion.Pdf.Security;
75

86
//Create a new PDF document.
9-
PdfDocument document = new PdfDocument();
10-
11-
//Add page to the document.
12-
PdfPage page = document.Pages.Add();
13-
14-
//Create PDF graphics to the document.
15-
PdfGraphics graphics = page.Graphics;
7+
using (PdfDocument document = new PdfDocument())
8+
{
169

17-
//Set the font.
18-
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
10+
//Add page to the document.
11+
PdfPage page = document.Pages.Add();
1912

20-
//Set the brush.
21-
PdfBrush brush = PdfBrushes.Black;
13+
//Create PDF graphics to the document.
14+
PdfGraphics graphics = page.Graphics;
2215

23-
//Document security.
24-
PdfSecurity security = document.Security;
16+
//Set the font.
17+
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
2518

26-
//Specifies key size and encryption algorithm.
27-
security.KeySize = PdfEncryptionKeySize.Key128Bit;
28-
security.Algorithm = PdfEncryptionAlgorithm.RC4;
29-
security.OwnerPassword = "syncfusion";
19+
//Set the brush.
20+
PdfBrush brush = PdfBrushes.Black;
3021

31-
//It allows printing and accessibility copy content.
32-
security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.AccessibilityCopyContent;
33-
security.UserPassword = "password";
34-
graphics.DrawString("This document is protected with owner password", font, brush, new PointF(0, 40));
22+
//Document security.
23+
PdfSecurity security = document.Security;
3524

36-
//Create file stream.
37-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
38-
{
39-
//Save the PDF document to file stream.
40-
document.Save(outputFileStream);
41-
}
25+
//Specifies key size and encryption algorithm.
26+
security.KeySize = PdfEncryptionKeySize.Key128Bit;
27+
security.Algorithm = PdfEncryptionAlgorithm.RC4;
28+
security.OwnerPassword = "syncfusion";
4229

43-
//Close the document.
44-
document.Close(true);
30+
//It allows printing and accessibility copy content.
31+
security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.AccessibilityCopyContent;
32+
security.UserPassword = "password";
33+
graphics.DrawString("This document is protected with owner password", font, brush, new PointF(0, 40));
34+
//Save the PDF document
35+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
36+
}
Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,33 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Drawing;
1+
using Syncfusion.Drawing;
42
using Syncfusion.Pdf;
53
using Syncfusion.Pdf.Graphics;
64
using Syncfusion.Pdf.Security;
75

86
//Create a new PDF document.
9-
PdfDocument document = new PdfDocument();
10-
11-
//Add page to the document.
12-
PdfPage page = document.Pages.Add();
13-
14-
//Create PDF graphics for the page.
15-
PdfGraphics graphics = page.Graphics;
7+
using (PdfDocument document = new PdfDocument())
8+
{
9+
//Add page to the document.
10+
PdfPage page = document.Pages.Add();
1611

17-
//Set the font.
18-
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
12+
//Create PDF graphics for the page.
13+
PdfGraphics graphics = page.Graphics;
1914

20-
//Set the brush.
21-
PdfBrush brush = PdfBrushes.Black;
15+
//Set the font.
16+
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
2217

23-
//Document security.
24-
PdfSecurity security = document.Security;
18+
//Set the brush.
19+
PdfBrush brush = PdfBrushes.Black;
2520

26-
//Specifies key size and encryption algorithm.
27-
security.KeySize = PdfEncryptionKeySize.Key128Bit;
28-
security.Algorithm = PdfEncryptionAlgorithm.RC4;
29-
security.UserPassword = "password";
21+
//Document security.
22+
PdfSecurity security = document.Security;
3023

31-
//Draw the text.
32-
graphics.DrawString("Encrypted with RC4 128bit", font, brush, new PointF(0, 40));
24+
//Specifies key size and encryption algorithm.
25+
security.KeySize = PdfEncryptionKeySize.Key128Bit;
26+
security.Algorithm = PdfEncryptionAlgorithm.RC4;
27+
security.UserPassword = "password";
3328

34-
//Create file stream.
35-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
36-
{
37-
//Save the PDF document to file stream.
38-
document.Save(outputFileStream);
29+
//Draw the text.
30+
graphics.DrawString("Encrypted with RC4 128bit", font, brush, new PointF(0, 40));
31+
//Save the PDF document
32+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
3933
}
40-
41-
//Close the document.
42-
document.Close(true);
Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,36 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Drawing;
1+
using Syncfusion.Drawing;
42
using Syncfusion.Pdf;
53
using Syncfusion.Pdf.Graphics;
64
using Syncfusion.Pdf.Security;
75

86
//Create a new PDF document.
9-
PdfDocument document = new PdfDocument();
10-
11-
//Add page to the document.
12-
PdfPage page = document.Pages.Add();
13-
14-
//Create PDF graphics for the page.
15-
PdfGraphics graphics = page.Graphics;
7+
using (PdfDocument document = new PdfDocument())
8+
{
9+
//Add page to the document.
10+
PdfPage page = document.Pages.Add();
1611

17-
//Set the font.
18-
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
12+
//Create PDF graphics for the page.
13+
PdfGraphics graphics = page.Graphics;
1914

20-
//Set the brush.
21-
PdfBrush brush = PdfBrushes.Black;
15+
//Set the font.
16+
PdfStandardFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20f, PdfFontStyle.Bold);
2217

23-
//Document security.
24-
PdfSecurity security = document.Security;
18+
//Set the brush.
19+
PdfBrush brush = PdfBrushes.Black;
2520

26-
//Specifies key size and encryption algorithm.
27-
security.KeySize = PdfEncryptionKeySize.Key256Bit;
28-
security.Algorithm = PdfEncryptionAlgorithm.AES;
21+
//Document security.
22+
PdfSecurity security = document.Security;
2923

30-
//Specifies encryption option.
31-
security.EncryptionOptions = PdfEncryptionOptions.EncryptAllContentsExceptMetadata;
32-
security.UserPassword = "password";
24+
//Specifies key size and encryption algorithm.
25+
security.KeySize = PdfEncryptionKeySize.Key256Bit;
26+
security.Algorithm = PdfEncryptionAlgorithm.AES;
3327

34-
//Draw the text.
35-
graphics.DrawString("Encrypted all contents except metadata with AES 256bit", font, brush, new PointF(0, 40));
28+
//Specifies encryption option.
29+
security.EncryptionOptions = PdfEncryptionOptions.EncryptAllContentsExceptMetadata;
30+
security.UserPassword = "password";
3631

37-
//Create file stream.
38-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
39-
{
40-
//Save the PDF document to file stream.
41-
document.Save(outputFileStream);
32+
//Draw the text.
33+
graphics.DrawString("Encrypted all contents except metadata with AES 256bit", font, brush, new PointF(0, 40));
34+
//Save the PDF document
35+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
4236
}
43-
44-
//Close the document.
45-
document.Close(true);

0 commit comments

Comments
 (0)