PDF Security
Mã hoá các tệp PDF của bạn bằng công cụ .NET của Documentize để bảo vệ thông tin nhạy cảm.
Giải mã các tệp PDF của bạn bằng công cụ .NET của Documentize để mở tài liệu.
Ký điện tử các tệp PDF bằng các công cụ .NET của Documentize — đảm bảo an ninh, tính xác thực và tuân thủ một cách dễ dàng.
Làm sạch dữ liệu ẩn trong PDF bằng công cụ .NET của Documentize, đảm bảo rằng các thông tin nhạy cảm hoặc không cần thiết như siêu dữ liệu, tệp đính kèm, chú thích, JavaScripts, biểu mẫu, lớp, chỉ mục tìm kiếm hoặc nội dung riêng tư được loại bỏ hoặc biến đổi.
Tiểu mục của PDF Security
Mã hoá
The Documentize PDF Security for .NET là một công cụ mạnh mẽ được thiết kế để nâng cao bảo mật cho tài liệu PDF của bạn bằng cách cung cấp các khả năng mã hoá, giải mã và ký số. Nó đảm bảo rằng thông tin nhạy cảm của bạn luôn được giữ bí mật và được bảo vệ khỏi việc truy cập trái phép.
Cách mã hoá một tệp PDF
Để mã hoá một tài liệu PDF, làm theo các bước sau:
- Tạo một thể hiện của
EncryptOptions với mật khẩu người dùng và chủ sở hữu mong muốn. - Thêm tệp PDF đầu vào bằng phương thức
AddInput. - Thêm tệp PDF đầu ra bằng phương thức
AddOutput. - Thực thi việc mã hoá bằng phương thức
Encrypt của lớp PdfSecurity.
1// Create EncryptOptions object to set instructions
2var options = new EncryptOptions("123456", "qwerty");
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfSecurity.Encrypt(options);
Các tính năng chính:
- Mã hoá tài liệu PDF: Bảo mật các tệp PDF của bạn bằng cách thêm mật khẩu người dùng và chủ sở hữu.
- Tự động hoá: Tích hợp việc mã hoá và giải mã vào các ứng dụng .NET của bạn để tạo quy trình làm việc tự động.
- Tuân thủ: Đảm bảo tài liệu của bạn đáp ứng các tiêu chuẩn công nghiệp về bảo mật tài liệu.
Giải mã
The Documentize PDF Security for .NET là một công cụ mạnh mẽ được thiết kế để tăng cường bảo mật cho các tài liệu PDF của bạn bằng cách cung cấp các khả năng mã hoá, giải mã và ký điện tử. Nó đảm bảo thông tin nhạy cảm của bạn luôn được giữ bí mật và bảo vệ khỏi truy cập trái phép.
Cách giải mã PDF
Để giải mã một tài liệu PDF, làm theo các bước sau:
- Tạo một thể hiện của
DecryptionOptions với mật khẩu cần thiết. - Thêm tệp PDF đầu vào bằng phương thức
AddInput. - Thêm tệp PDF đầu ra bằng phương thức
AddOutput. - Thực hiện việc giải mã bằng phương thức
Decrypt của lớp PdfSecurity.
1// Create DecryptOptions object to set instructions
2var options = new DecryptOptions("123456");
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfSecurity.Decrypt(options);
Các tính năng chính:
- Giải mã tài liệu PDF: Loại bỏ mã hoá khỏi các file PDF khi cần.
- Tự động hoá: Tích hợp mã hoá và giải mã vào các ứng dụng .NET của bạn để tạo quy trình làm việc tự động.
- Tuân thủ: Đảm bảo tài liệu của bạn đáp ứng các tiêu chuẩn công nghiệp về bảo mật tài liệu.
Ký
The Documentize PDF Security for .NET component allows users to digitally sign PDF documents. It offers a streamlined process for adding signatures, ensuring authenticity, and securing PDF content. The component supports both visible and invisible signatures and provides options to customize the signature’s position, reason, contact information, and more.
How to Sign PDF Documents
To sign a PDF document using a PFX file, follow these steps:
- Instantiate the
SignOptions class with the PFX file path and password. - Add the input PDF and the output file to the options.
- Run the
Sign method to apply the signature.
1// Create SignOptions object to set instructions
2var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfSecurity.Sign(options);
How to Use Stream for PFX File
You can also sign a PDF using a PFX certificate provided as a stream instead of a file path. This allows more flexible handling of certificate storage.
1using var pfxStream = File.OpenRead(@"path_to_your_pfx_file.pfx");
2var options = new SignOptions(pfxStream, "password_of_your_pfx_file");
3options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
4options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
5// Perform the process
6PdfSecurity.Sign(options);
How to Apply Invisible Signatures
To add an invisible signature (one that secures the document without displaying the signature on the document), simply set the Visible property to false.
- Create an instance of
SignOptions. - Set
Visible to false. - Add input and output files.
- Call
Sign to apply the invisible signature.
1var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
2options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
3options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
4// Configure invisible signature
5signOptions.Visible = false;
6// Perform the process
7PdfSecurity.Sign(options);
You can use extra options during adding signature to a PFX file like Reason, Contact, Location, PageNumber.
- Instantiate the
SignOptions class with the PFX file path and password. - Add the input PDF and the output file to the options.
- Set values for your options.
- Run the
Sign method to apply the signature.
1// Create SignOptions object to set instructions
2var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Optional parameters
8options.Reason = "my Reason";
9options.Contact = "my Contact";
10options.Location = "my Location";
11options.PageNumber = 3;
12// Perform the process
13PdfSecurity.Sign(options);
How to Add a Timestamp to PDF
To add a secure timestamp to a PDF document, follow these steps:
- Create an instance of
AddTimestampOptions to configure the timestamping process. - Add the input PDF file using the
AddInput method. - Set the output file path using
AddOutput. - Execute the timestamping using the
Sign method.
1// Create SignOptions object to set instructions
2var options = new SignOptions("path_to_your_pfx_file.pfx", "password_for_your_pfx_file");
3options.TimestampOptions = new TimestampOptions("server_url");
4// Add input file path
5options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
6// Set output file path
7options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
8// Perform the process
9PdfSecurity.Sign(options);
How to Use Custom Authentication with Timestamp Server
You can provide basic authentication credentials when connecting to the timestamp server. This allows you to authenticate with servers that require a username and password.
1// Configure the timestamping options with authentication
2options.TimestampOptions = new TimestampOptions("timestamp_server_url", "username:password");
Key Features:
- Digitally Sign PDF Documents: Secure your documents with visible or invisible digital signatures.
- PFX Support: Sign PDF files using a PFX certificate.
- Customizable Options: Configure signature settings like reason, location, and contact details.
- Visible and Invisible Signatures: Choose whether the signature is visible on the document.
- Customizable Timestamp Servers: Use custom timestamp server URLs and authentication credentials.
Làm sạch
Thành phần Documentize PDF Security for .NET cho phép người dùng làm sạch (sanitize) tài liệu PDF. Nó cung cấp một quy trình đơn giản để bỏ các thông tin nhạy cảm hoặc không cần thiết như siêu dữ liệu, tệp đính kèm, chú thích, JavaScripts, biểu mẫu, lớp, chỉ mục tìm kiếm hoặc nội dung riêng tư. Thành phần này cung cấp các tùy chọn để tùy chỉnh những thông tin sẽ bị xóa.
Xóa thông tin
- Siêu dữ liệu
- Tệp đính kèm
- Chú thích
- Java Scripts
- Biểu mẫu
- Lớp
- Chỉ mục tìm kiếm
Cách làm sạch tài liệu PDF
Để làm sạch một tệp PDF, làm theo các bước sau:
- Tạo một đối tượng
SanitizeOptions với đường dẫn tệp đầu vào và đường dẫn tệp đầu ra. - Gọi phương thức
Sanitize để thực hiện quá trình làm sạch.
1// Tạo đối tượng SanitizeOptions để thiết lập tệp đầu vào và đầu ra
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3// Thực hiện quy trình
4PdfSecurity.Sanitize(options);
Cách sử dụng Stream cho dữ liệu đầu vào và đầu ra
Bạn cũng có thể thực hiện việc làm sạch bằng cách cung cấp tài liệu PDF dưới dạng stream thay vì chỉ định đường dẫn tệp.
1// Chuẩn bị các stream đầu vào và đầu ra
2using var inputStream = File.OpenRead("path_to_your_pdf_file.pdf");
3using var outputStream = new MemoryStream();
4// Tạo đối tượng SanitizeOptions để thiết lập stream đầu vào và đầu ra
5var options = new SanitizeOptions(inputStream, outputStream);
6// Thực hiện quy trình
7PdfSecurity.Sanitize(options);
Cách làm sạch từ tệp tới stream
Bạn có thể đặt các kiểu dữ liệu đầu vào và đầu ra khác nhau.
1// Chuẩn bị stream đầu ra
2using var outputStream = new MemoryStream();
3// Tạo đối tượng SanitizeOptions để thiết lập tệp đầu vào và stream đầu ra
4var options = new SanitizeOptions("path_to_your_pdf_file.pdf", outputStream);
5// Thực hiện quy trình
6PdfSecurity.Sanitize(options);
Cách làm sạch từ tệp tới stream bằng thuộc tính
Bạn có thể đặt các kiểu dữ liệu đầu vào và đầu ra bằng cách sử dụng các thuộc tính.
1// Chuẩn bị stream đầu ra
2using var outputStream = new MemoryStream();
3// Tạo đối tượng SanitizeOptions
4var options = new SanitizeOptions();
5// Đặt tệp đầu vào
6options.Input = new FileData("path_to_your_pdf_file.pdf");
7// Đặt stream đầu ra
8options.Output = new StreamData(outputStream);
9// Thực hiện quy trình
10PdfSecurity.Sanitize(options);
Làm sạch mà không xóa Siêu dữ liệu
Chỉ cần đặt thuộc tính RemoveMetadata thành false.
1// Tạo đối tượng SanitizeOptions để thiết lập tệp đầu vào và đầu ra
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveMetadata = false;
4// Thực hiện quy trình
5PdfSecurity.Sanitize(options);
Làm sạch mà không xóa Tệp đính kèm
Chỉ cần đặt thuộc tính RemoveAttachments thành false.
1// Tạo đối tượng SanitizeOptions để thiết lập tệp đầu vào và đầu ra
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveAttachments = false;
4// Thực hiện quy trình
5PdfSecurity.Sanitize(options);
Làm sạch với việc chuyển đổi tất cả các trang thành hình ảnh và thiết lập DPI kết quả
Ví dụ dưới đây minh họa cách làm sạch PDF bằng cách chuyển đổi tất cả các trang thành hình ảnh và đặt DPI cho kết quả.
Đặt thuộc tính ConvertPagesToImages thành true. Thay đổi ImageDpi nếu cần.
1// Tạo đối tượng SanitizeOptions để thiết lập tệp đầu vào và đầu ra
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3// Bật chuyển đổi và đặt DPI
4options.ConvertPagesToImages = true;
5options.ImageDpi = 200;
6// Thực hiện quy trình
7PdfSecurity.Sanitize(options);
Làm sạch mà không xóa JavaScripts và Actions
Chỉ cần đặt thuộc tính RemoveJavaScriptsAndActions thành false.
1// Tạo đối tượng SanitizeOptions để thiết lập tệp đầu vào và đầu ra
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveJavaScriptsAndActions = false;
4// Thực hiện quy trình
5PdfSecurity.Sanitize(options);
Làm sạch tệp PDF theo cách ngắn gọn nhất có thể
1PdfSecurity.Sanitize(new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf"));
Các tính năng chính:
- Làm sạch tài liệu PDF: Loại bỏ dữ liệu có thể gây nguy hiểm khỏi tài liệu.
- Tùy chọn có thể cấu hình: Chọn những gì sẽ bị xóa và những gì sẽ được giữ lại.
- Chuyển đổi thành hình ảnh: Chuyển các trang thành hình ảnh, nhưng vẫn giữ ở dạng PDF.