Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
تختلف فئة PdfPageEditor عن فئة PdfFileEditor وفئة PdfContentEditor. أولاً، نحتاج إلى فهم الفرق، ثم سنكون قادرين على فهم فئة PdfPageEditor بشكل أفضل. تتيح لك فئة PdfFileEditor التلاعب بجميع الصفحات في ملف مثل إضافة الصفحات أو حذفها أو دمجها، بينما تساعدك فئة PdfContentEditor في التلاعب بمحتويات الصفحة مثل النص والأشياء الأخرى. بينما تعمل فئة PdfPageEditor فقط مع الصفحة الفردية نفسها مثل التدوير والتكبير والمحاذاة وما إلى ذلك.
يمكننا تقسيم الميزات التي توفرها هذه الفئة إلى ثلاث فئات رئيسية وهي: الانتقال، والمحاذاة، والعرض. سنناقش هذه الفئات أدناه:
تحتوي هذه الفئة على خاصيتين تتعلقان بالانتقال وهما TransitionType و TransitionDuration. تحدد TransitionType نمط الانتقال الذي سيتم استخدامه عند الانتقال إلى هذه الصفحة من صفحة أخرى أثناء العرض. تحدد TransitionDuration مدة عرض الصفحات.
تدعم فئة PdfPageEditor كل من المحاذاة الأفقية والعمودية. توفر خاصيتين لخدمة هذا الغرض وهما Alignment و VerticalAlignment. تُستخدم خاصية Alignment لمحاذاة المحتويات أفقيًا. تأخذ خاصية Alignment قيمة من AlignmentType، والتي تحتوي على ثلاث خيارات وهي: Center و Left و Right. تأخذ خاصية VerticalAlignment قيمة من VerticalAlignmentType، والتي تحتوي على ثلاث خيارات وهي: Bottom و Center و Top.
تحت فئة العرض، يمكننا تضمين خصائص مثل PageSize و Rotation و Zoom و DisplayDuration. تحدد خاصية PageSize حجم الصفحة الفردية في الملف. تأخذ هذه الخاصية كائن PageSize كمدخل، والذي ي encapsulates حجم الصفحة المحدد مسبقًا مثل A0 و A1 و A2 و A3 و A4 و A5 و A6 و B5 و Letter و Ledger و P11x17. تُستخدم خاصية Rotation لتعيين تدوير الصفحة الفردية. يمكن أن تأخذ القيم 0 أو 90 أو 180 أو 270. تحدد خاصية Zoom معامل التكبير للصفحة، وتأخذ قيمة عائمة كمدخل. توفر هذه الفئة أيضًا طريقة للحصول على حجم الصفحة وتدوير الصفحة الفردية في الملف.
يمكنك العثور على عينات من الأساليب المذكورة أعلاه في مقتطف الشيفرة أدناه
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void EditPdfPages()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create a new instance of PdfPageEditor class
using (var pdfPageEditor = new Aspose.Pdf.Facades.PdfPageEditor())
{
// Bind PDF document
pdfPageEditor.BindPdf(dataDir + "FilledForm.pdf");
// Specify an array of pages which need to be manipulated (pages can be multiple, here we have specified only one page)
pdfPageEditor.ProcessPages = new int[] { 1 };
// Alignment related code
pdfPageEditor.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
// Specify transition type for the pages
pdfPageEditor.TransitionType = 2;
// Specify transition duration
pdfPageEditor.TransitionDuration = 5;
// Display related code
// Select a page size from the enumeration and assign to property
pdfPageEditor.PageSize = Aspose.Pdf.PageSize.PageLedger;
// Assign page rotation
pdfPageEditor.Rotation = 90;
// Specify zoom factor for the page
pdfPageEditor.Zoom = 100;
// Assign display duration for the page
pdfPageEditor.DisplayDuration = 5;
// Fetching methods
// Methods provided by the class, page rotation specified already
var rotation = pdfPageEditor.GetPageRotation(1);
// Already specified page can be fetched
var pageSize = pdfPageEditor.GetPageSize(1);
// This method gets the page count
var totalPages = pdfPageEditor.GetPages();
// This method changes the origin from (0,0) to specified number
pdfPageEditor.MovePosition(100, 100);
// Save PDF document
pdfPageEditor.Save(dataDir + "EditPdfPages_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.