Please give a brief summary of your issue:
Is it possible to extract annotations directly from the FDFDoc.
I have created the FDFDoc as shown below using the xfdf file stream:
var xfdfString = new StreamReader(xfdfStream).ReadToEnd();
using (var xfdfDocument = new FDFDoc(FDFDoc.CreateFromXFDF(xfdfString)))
Instead of using the PdfDoc to retrieve the annotations, I would like to know if it is possible to extract annotations directly from the FDFDoc, as the XFDF file already contains all the annotations.
Hello, I'm AiRon, an automated tech support bot 🤖 While you wait for one of our customer support representatives, I can help you with your question.
Yes, it is possible to work with annotations directly from an FDFDoc in Apryse's PDF software APIs. The FDFDoc object allows you to interact with form data, including annotations, without needing to merge it into a PDFDoc first.
Some things you can try:
Use the FDFDoc object to parse and manipulate annotations directly from the XFDF data.
Access the annotations in the FDFDoc using methods designed for reading and exporting annotation data.
Consider exporting the annotations to a format that suits your needs, such as XFDF, if further processing is required.
Hi,
The current approach we are using to extract comments involves accessing annotations from each page via the PDFDoc object.
Specifically, we are utilizing the PDFDoc to retrieve the annotations.
Instead of this method, is it possible to directly use the FDFDoc generated from the XFDF stream to access annotations, without needing to merge it with the PDFDoc?
Below code snippet shows the approach we are using:
using (var pdfDocument = new PDFDoc(filePath))
{
if (pdfDocument.IsEncrypted())
return Array.Empty();
var xfdfString = new StreamReader(xfdfStream).ReadToEnd();
using (var xfdfDocument = new FDFDoc(FDFDoc.CreateFromXFDF(xfdfString)))
{
pdfDocument.FDFUpdate(xfdfDocument);
var pageCount = pdfDocument.GetPageCount();
for (var pageIndex = 1; pageIndex <= pageCount; pageIndex++)
{
var page = pdfDocument.GetPage(pageIndex);
var annotationCount = page.GetNumAnnots();
for (var annotationIndex = 0; annotationIndex < annotationCount; annotationIndex++)
{
var annotation = page.GetAnnot(annotationIndex);
}
}
}
}