تشفير
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// 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);
كيفية استخدام Stream لملف PFX
يمكنك أيضًا توقيع PDF باستخدام شهادة PFX مقدمة كـ stream بدلاً من مسار ملف. يتيح ذلك مرونة أكبر في التعامل مع تخزين الشهادة.
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);
كيفية تطبيق التوقيعات غير المرئية
لإضافة توقيع غير مرئي (يؤمّن المستند دون عرض التوقيع على المستند)، ببساطة عيّن الخاصية Visible إلى false.
- أنشئ مثيلًا من
SignOptions. - عيّن
Visible إلى false. - أضف ملفات الإدخال والإخراج.
- استدعِ
Sign لتطبيق التوقيع غير المرئي.
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);
كيفية استخدام خيارات إضافية لتوقيع مستندات PDF
يمكنك استخدام خيارات إضافية عند إضافة توقيع إلى ملف PFX مثل السبب، جهة الاتصال، الموقع، رقم الصفحة.
- أنشئ كائنًا من الفئة
SignOptions مع مسار ملف PFX وكلمة المرور. - أضف ملف PDF الإدخال وملف الإخراج إلى الخيارات.
- عيّن القيم للخيارات التي تريدها.
- نفّذ طريقة
Sign لتطبيق التوقيع.
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);
كيفية إضافة طابع زمني إلى PDF
لإضافة طابع زمني آمن إلى مستند PDF، اتبع الخطوات التالية:
- أنشئ مثيلًا من
AddTimestampOptions لتهيئة عملية الطابع الزمني. - أضف ملف PDF الإدخال باستخدام طريقة
AddInput. - عيّن مسار ملف الإخراج باستخدام
AddOutput. - نفّذ عملية الطابع الزمني باستخدام طريقة
Sign.
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);
كيفية استخدام مصادقة مخصصة مع خادم الطابع الزمني
يمكنك توفير بيانات اعتماد المصادقة الأساسية عند الاتصال بخادم الطابع الزمني. يتيح لك ذلك المصادقة مع الخوادم التي تتطلب اسم مستخدم وكلمة مرور.
1// Configure the timestamping options with authentication
2options.TimestampOptions = 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.