Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
يمكن أن تحتوي المرفقات على مجموعة واسعة من المعلومات ويمكن أن تكون من أنواع ملفات متنوعة. تشرح هذه المقالة كيفية إضافة مرفق إلى ملف PDF.
يعمل مقتطف الكود التالي أيضًا مع مكتبة Aspose.Drawing.
تحتوي مجموعة EmbeddedFiles على جميع المرفقات في ملف PDF. يوضح لك مقتطف الكود التالي كيفية إضافة مرفق في مستند PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddEmbeddedFile()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Attachments();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "AddAttachment.pdf"))
{
// Setup new file to be added as attachment
Aspose.Pdf.FileSpecification fileSpecification = new Aspose.Pdf.FileSpecification(dataDir + "test.txt", "Sample text file");
// Add attachment to document's attachment collection
document.EmbeddedFiles.Add(fileSpecification);
// Save PDF document
document.Save(dataDir + "AddAnnotations_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.