Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.PDF for .NET هو مكون غني بالميزات عندما يتعلق الأمر بتحرير مستندات PDF. كما نعلم، فإن XFDF هو جانب مهم من جوانب معالجة نماذج PDF، وقد أخذت مساحة أسماء Aspose.Pdf.Facades في Aspose.PDF for .NET هذا بعين الاعتبار، وقدمت طرقًا لاستيراد وتصدير بيانات التعليقات التوضيحية إلى ملفات XFDF.
تحتوي فئة PDFAnnotationEditor على طريقتين للعمل مع استيراد وتصدير التعليقات التوضيحية إلى ملف XFDF. توفر طريقة ExportAnnotationsXfdf الوظيفة لتصدير التعليقات التوضيحية من مستند PDF إلى ملف XFDF، بينما تتيح لك طريقة ImportAnnotationFromXfdf استيراد التعليقات التوضيحية من ملف XFDF موجود. لاستيراد أو تصدير التعليقات التوضيحية، نحتاج إلى تحديد أنواع التعليقات التوضيحية. يمكننا تحديد هذه الأنواع في شكل تعداد ثم تمرير هذا التعداد كوسيط إلى أي من هذه الطرق. بهذه الطريقة، سيتم استيراد أو تصدير التعليقات التوضيحية من الأنواع المحددة فقط إلى ملف XFDF.
تعمل مقتطفات الكود التالية أيضًا مع مكتبة Aspose.PDF.Drawing.
تظهر مقتطفات الكود التالية كيفية تصدير التعليقات التوضيحية إلى ملف XFDF:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ExportAnnotationsToXfdf()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();
// Create PdfAnnotationEditor object
using (var annotationEditor = new Aspose.Pdf.Facades.PdfAnnotationEditor())
{
// Bind PDF document
annotationEditor.BindPdf(dataDir + "AnnotationDemo1.pdf");
// Define the annotation types to export
var annotType = new Aspose.Pdf.Annotations.AnnotationType[] { Aspose.Pdf.Annotations.AnnotationType.Line, Aspose.Pdf.Annotations.AnnotationType.Square };
// Export annotations to XFDF file
using (var fileStream = File.OpenWrite(dataDir + "exportannotations_out.xfdf"))
{
annotationEditor.ExportAnnotationsXfdf(fileStream, 1, 1, annotType);
fileStream.Flush();
}
}
}
تصف مقتطفة الكود التالية كيفية استيراد التعليقات التوضيحية من ملف XFDF:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ImportAnnotationFromXfdf()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();
// Create PdfAnnotationEditor object
using (var annotationEditor = new Aspose.Pdf.Facades.PdfAnnotationEditor())
{
// Create PDF document
using (var document = new Aspose.Pdf.Document())
{
// Add page
var page = document.Pages.Add();
// Bind PDF document
annotationEditor.BindPdf(document);
// Define the export file name
var exportFileName = dataDir + "exportannotations.xfdf";
// Import annotations from the XFDF file
annotationEditor.ImportAnnotationsFromXfdf(exportFileName);
// Save PDF document
document.Save(dataDir + "ImportAnnotationFromXfdf_out.pdf");
}
}
}
في الكود أدناه، تتيح طريقة ImportAnnotations استيراد التعليقات التوضيحية مباشرة من مستند PDF آخر.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ImportAnnotationFromPDF()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();
// Open PDF document
using (var documentFrom = new Aspose.Pdf.Document(dataDir + "some_doc.pdf"))
{
// Create PDF document
using (var documentTo = new Aspose.Pdf.Document())
{
// Add page
var page = documentTo.Pages.Add();
// Export/import
using (var ms = new MemoryStream())
{
documentFrom.ExportAnnotationsToXfdf(ms);
documentTo.ImportAnnotationsFromXfdf(ms);
}
// Save PDF document
documentTo.Save(dataDir + "AnnotationDemo3_out.pdf");
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.