تشفير
The Documentize PDF Security for .NET هو أداة قوية صُممت لتعزيز أمان مستندات PDF الخاصة بك من خلال توفير قدرات التشفير، وفك التشفير، والتوقيع. يضمن ذلك بقاء معلوماتك الحساسة سرية ومحمية من الوصول غير المصرح به.
كيفية تشفير ملف PDF
لتشفير مستند PDF، اتبع الخطوات التالية:
- إنشاء مثال من
EncryptOptions باستخدام كلمات المرور الخاصة بالمستخدم والمالك المطلوبة. - إضافة ملف PDF المدخل باستخدام طريقة
AddInput. - إضافة ملف PDF الناتج باستخدام طريقة
AddOutput. - تنفيذ عملية التشفير باستخدام طريقة
Encrypt من فئة 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);
الميزات الرئيسية:
- تشفير مستندات PDF: امنح ملفات PDF الخاصة بك الحماية عن طريق إضافة كلمات مرور المستخدم والمالك.
- الأتمتة: دمج التشفير وفك التشفير في تطبيقات .NET الخاصة بك لتسهيل سير العمل التلقائي.
- الامتثال: تأكد من أن مستنداتك تلبي المعايير الصناعية لأمان الوثائق.
فك التشفير
The Documentize PDF Security for .NET is a powerful tool designed to enhance the security of your PDF documents by providing encryption, decryption and signing capabilities. It ensures that your sensitive information remains confidential and protected from unauthorized access.
How to Decrypt a PDF
To decrypt a PDF document, follow these steps:
- Create an instance of
DecryptionOptions with the necessary password. - Add the input PDF file using the
AddInput method. - Add the output PDF file using
AddOutput method. - Execute the encryption using the
Decrypt method of PdfSecurity class.
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);
Key Features:
- Decrypt PDF Documents: Remove encryption from PDFs when needed.
- Automation: Integrate encryption and decryption into your .NET applications for automated workflows.
- Compliance: Ensure your documents meet industry standards for document security.
توقيع
يتيح مكوّن Documentize PDF Security for .NET للمستخدمين توقيع مستندات PDF رقميًا. يوفر عملية مبسطة لإضافة التوقيعات، مما يضمن الأصالة وتأمين محتوى PDF. يدعم المكوّن كلًا من التوقيعات الظاهرة والغير ظاهرة ويقدّم خيارات لتخصيص موضع التوقيع، السبب، معلومات الاتصال، وأكثر.
كيفية توقيع مستندات PDF
لتوقيع مستند PDF باستخدام ملف PFX، اتبع الخطوات التالية:
- أنشئ كائنًا من الفئة
SignOptions مع مسار ملف PFX وكلمة المرور. - أضف ملف PDF المُدخل والملف الناتج إلى الخيارات.
- نفّذ طريقة
Sign لتطبيق التوقيع.
1
2// Create SignOptions object to set instructions
3var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
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);
كيفية استخدام Stream لملف PFX
يمكنك أيضًا توقيع PDF باستخدام شهادة PFX مُقدمة كـ stream بدلاً من مسار ملف. هذا يتيح مرونة أكبر في إدارة تخزين الشهادة.
1
2using var pfxStream = File.OpenRead(@"path_to_your_pfx_file.pfx");
3var options = new SignOptions(pfxStream, "password_of_your_pfx_file");
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
6// Perform the process
7PdfSecurity.Sign(options);
كيفية تطبيق التواقيع غير الظاهرة
لإضافة توقيع غير ظاهر (أي توثيق المستند دون عرض التوقيع على المستند)، ما عليك سوى ضبط خاصية Visible إلى false.
- أنشئ كائنًا من
SignOptions. - اضبط
Visible على false. - أضف ملفات الإدخال والإخراج.
- استدعِ
Sign لتطبيق التوقيع غير الظاهر.
1
2var options = new SignOptions("path_to_your_pfx_file.pfx", "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// Configure invisible signature
6signOptions.Visible = false;
7// Perform the process
8PdfSecurity.Sign(options);
كيفية استخدام خيارات إضافية لتوقيع مستندات PDF
يمكنك تمرير خيارات إضافية أثناء إضافة توقيع إلى ملف PFX مثل السبب، جهة الاتصال، الموقع، رقم الصفحة.
- أنشئ كائنًا من الفئة
SignOptions مع مسار ملف PFX وكلمة المرور. - أضف ملف PDF المُدخل والملف الناتج إلى الخيارات.
- عيّن القيم الخاصة بالخيارات.
- نفّذ طريقة
Sign لتطبيق التوقيع.
1
2// Create SignOptions object to set instructions
3var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
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// Optional parameters
9options.Reason = "my Reason";
10options.Contact = "my Contact";
11options.Location = "my Location";
12options.PageNumber = 3;
13// Perform the process
14PdfSecurity.Sign(options);
كيفية إضافة طابع زمني إلى PDF
لإضافة طابع زمني آمن إلى مستند PDF، اتبع الخطوات التالية:
- أنشئ كائنًا من
TimestampOptions وSignOptions لتكوين عملية الطابع الزمني. - أضف ملف PDF المُدخل باستخدام طريقة
AddInput. - حدد مسار ملف الإخراج باستخدام طريقة
AddOutput. - نفّذ عملية الطابع الزمني باستخدام طريقة
Sign.
1
2var tOptions = new TimestampOptions("server_url");
3// Create SignOptions object to set Timestamp
4var options = new SignOptions(new TimestampOptions(tOptions));
5// Add input file path
6options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
7// Set output file path
8options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
9// Perform the process
10PdfSecurity.Sign(options);
كيفية استخدام المصادقة المخصَّصة مع خادم الطابع الزمني
يمكنك تقديم بيانات اعتماد المصادقة الأساسية عند الاتصال بخادم الطابع الزمني. يتيح هذا لك المصادقة مع الخوادم التي تتطلّب اسم مستخدم وكلمة مرور.
1
2// Configure the timestamping options with authentication
3var tOptions = new TimestampOptions("timestamp_server_url", "username:password");
الميزات الرئيسية:
- التوقيع الرقمي لمستندات PDF: احمِ مستنداتك بتواقيع رقمية ظاهرة أو غير ظاهرة.
- دعم PFX: وقّع ملفات PDF باستخدام شهادة PFX.
- خيارات قابلة للتخصيص: عيّن إعدادات التوقيع مثل السبب والموقع ومعلومات الاتصال.
- تواقيع ظاهرة وغير ظاهرة: اختر ما إذا كان التوقيع ظاهرًا على المستند.
- خوادم طابع زمني مخصَّصة: استخدم عناوين URL لخوادم الطابع الزمني مع بيانات اعتماد المصادقة.
تنقية
The Documentize PDF Security for .NET component allows users to sanitize PDF documents. It offers a streamlined process for remove sensitive or unnecessary information such as metadata, attachments, annotations, JavaScripts, forms, layers, search index, or private content. The component provides options to customize information that will be deleted.
Clearing information
- Metadata
- Attachments
- Annotations
- Java Scripts
- Forms
- Layers
- Search index
How to Sanitize PDF documents
To Sanitize a PDF file, follow these steps:
- Instantiate the
SanitizeOptions class with the input file path and the output file path. - Run the
Sanitize method to apply the sanitization.
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3// Perform the process
4PdfSecurity.Sanitize(options);
You can also perform cleaning using PDF documents provided as a stream instead of specifying a file path.
1// Prepare input and output streams
2using var inputStream = File.OpenRead("path_to_your_pdf_file.pdf");
3using var outputStream = new MemoryStream();
4// Create SanitizeOptions object to set input and output streams
5var options = new SanitizeOptions(inputStream, outputStream);
6// Perform the process
7PdfSecurity.Sanitize(options);
How to Sanitize from file to stream
You can set different types of input and output data.
1// Prepare output stream
2using var outputStream = new MemoryStream();
3// Create SanitizeOptions object to set input file and output stream
4var options = new SanitizeOptions("path_to_your_pdf_file.pdf", outputStream);
5// Perform the process
6PdfSecurity.Sanitize(options);
How to Sanitize from file to stream by properties
You can set different types of input and output data by using properties.
1// Prepare output stream
2using var outputStream = new MemoryStream();
3// Create SanitizeOptions object
4var options = new SanitizeOptions();
5//Set Input file
6options.Input = new FileData("path_to_your_pdf_file.pdf");
7//Set Output stream
8options.Output = new StreamData(outputStream);
9// Perform the process
10PdfSecurity.Sanitize(options);
Simply set the RemoveMetadata property to false.
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveMetadata = false;
4// Perform the process
5PdfSecurity.Sanitize(options);
How to Sanitize without removing Attachments
Simply set the RemoveAttachments property to false.
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveAttachments = false;
4// Perform the process
5PdfSecurity.Sanitize(options);
How to Sanitize with converting all pages to images and set result dpi
The example demonstrates how to Sanitize PDF with converting all pages to images and set result dpi.
Set the ConvertPagesToImages property to true. Change ImageDpi if you need,
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3// Turn on conversion and set dpi
4options.ConvertPagesToImages = true;
5options.ImageDpi = 200;
6// Perform the process
7PdfSecurity.Sanitize(options);
How to Sanitize without removing JavaScripts and Actions
Simply set the RemoveJavaScriptsAndActions property to false.
1// Create SanitizeOptions object to set input and output files
2var options = new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf");
3options.RemoveJavaScriptsAndActions = false;
4// Perform the process
5PdfSecurity.Sanitize(options);
How to Sanitize PDF file in the shortest possible style
1PdfSecurity.Sanitize(new SanitizeOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf"));
Key Features:
- Sanitize PDF Documents: Cleaning a document of potentially dangerous data.
- Customizable options: Choose what to delete and what to leave.
- Convert to images: Convert pages to images, but stay as PDF.