Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
تتيح لك فئة PdfFileStamp إضافة رأس في ملف PDF. لإضافة رأس، تحتاج أولاً إلى إنشاء كائن من فئة PdfFileStamp. يمكنك تنسيق نص الرأس باستخدام فئة FormattedText. بمجرد أن تكون جاهزًا لإضافة الرأس في الملف، تحتاج إلى استدعاء طريقة AddHeader من فئة PdfFileStamp. تحتاج أيضًا إلى تحديد على الأقل الهامش العلوي في طريقة AddHeader. أخيرًا، احفظ ملف PDF الناتج باستخدام طريقة Close من فئة PdfFileStamp. يوضح لك المقتطف البرمجي التالي كيفية إضافة رأس في ملف PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddHeader()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PdfFileStamp object
using (var fileStamp = new Aspose.Pdf.Facades.PdfFileStamp())
{
// Bind PDF document
fileStamp.BindPdf(dataDir + "sample.pdf");
// Create formatted text for the header
var formattedText = new Aspose.Pdf.Facades.FormattedText(
"Aspose - Your File Format Experts!",
System.Drawing.Color.Yellow,
System.Drawing.Color.Black,
Aspose.Pdf.Facades.FontStyle.Courier,
Aspose.Pdf.Facades.EncodingType.Winansi,
false,
14);
// Add header
fileStamp.AddHeader(formattedText, 10);
// Save PDF document
fileStamp.Save(dataDir + "AddHeader_out.pdf");
}
}
تتيح لك فئة PdfFileStamp إضافة تذييل في ملف PDF. لإضافة تذييل، تحتاج أولاً إلى إنشاء كائن من فئة PdfFileStamp. يمكنك تنسيق نص التذييل باستخدام فئة FormattedText. بمجرد أن تكون جاهزًا لإضافة التذييل في الملف، تحتاج إلى استدعاء طريقة AddFooter من فئة PdfFileStamp. تحتاج أيضًا إلى تحديد على الأقل الهامش السفلي في طريقة AddFooter. أخيرًا، احفظ ملف PDF الناتج باستخدام طريقة Close من فئة PdfFileStamp. يوضح لك المقتطف البرمجي التالي كيفية إضافة تذييل في ملف PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddFooter()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PdfFileStamp object
using (var fileStamp = new Aspose.Pdf.Facades.PdfFileStamp())
{
// Bind PDF document
fileStamp.BindPdf(dataDir + "sample.pdf");
// Create formatted text for the footer
var formattedText = new Aspose.Pdf.Facades.FormattedText(
"Aspose - Your File Format Experts!",
System.Drawing.Color.Blue,
System.Drawing.Color.Gray,
Aspose.Pdf.Facades.FontStyle.Courier,
Aspose.Pdf.Facades.EncodingType.Winansi,
false,
14);
// Add footer
fileStamp.AddFooter(formattedText, 10);
// Save PDF document
fileStamp.Save(dataDir + "AddFooter_out.pdf");
}
}
تتيح لك فئة PdfFileStamp إضافة صورة في رأس ملف PDF. لإضافة صورة في الرأس، تحتاج أولاً إلى إنشاء كائن من فئة PdfFileStamp. بعد ذلك، تحتاج إلى استدعاء طريقة AddHeader من فئة PdfFileStamp. يمكنك تمرير الصورة إلى طريقة AddHeader. أخيرًا، احفظ ملف PDF الناتج باستخدام طريقة Close من فئة PdfFileStamp. يوضح لك المقتطف البرمجي التالي كيفية إضافة صورة في رأس ملف PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddImageHeader()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PdfFileStamp object
using (var fileStamp = new Aspose.Pdf.Facades.PdfFileStamp())
{
// Bind PDF document
fileStamp.BindPdf(dataDir + "sample.pdf");
// Add Header
using (var fs = new FileStream(dataDir + "ImageHeader.png", FileMode.Open))
{
fileStamp.AddHeader(fs, 10); // Add image header with position offset
// Save PDF document
fileStamp.Save(dataDir + "AddImageHeader_out.pdf");
}
}
}
تتيح لك فئة PdfFileStamp إضافة صورة في تذييل ملف PDF. لإضافة صورة في التذييل، تحتاج أولاً إلى إنشاء كائن من فئة PdfFileStamp. بعد ذلك، تحتاج إلى استدعاء طريقة AddFooter من فئة PdfFileStamp. يمكنك تمرير الصورة إلى طريقة AddFooter. أخيرًا، احفظ ملف PDF الناتج باستخدام طريقة Close من فئة PdfFileStamp. يوضح لك المقتطف البرمجي التالي كيفية إضافة صورة في تذييل ملف PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddImageFooter()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PdfFileStamp object
using (var fileStamp = new Aspose.Pdf.Facades.PdfFileStamp())
{
// Bind PDF document
fileStamp.BindPdf(dataDir + "sample.pdf");
// Add footer
using (var fs = new FileStream(dataDir + "ImageFooter.png", FileMode.Open))
{
fileStamp.AddFooter(fs, 10); // Add image footer with position offset
// Save PDF document
fileStamp.Save(dataDir + "AddImageFooter_out.pdf");
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.