Reputation: 59
I need to get all pdf rectangle coordinates(the drawing) i uploaded a pdf file.
i used syncfusion pdfviewer to draw the rectangle. i asked them how to get the rectangle coordinates but they emailed me that the control doesn't have a functionality right now for that.
this is the pdf file
https://drive.google.com/open?id=0B45rDxvaXzsmOGZiRXhRTnlmV2c
i'm searching for almost a day now but i can't find a way how to do it.
this is the screenshot of the pdf
Upvotes: 0
Views: 3103
Reputation: 29
We can get the rectangle coordinates by retrieving the annotations of the PDF page as PdfLoadedAnnotationCollection
.
Please find the code snippet to achieve the same.
PdfLoadedDocument pdf = new PdfLoadedDocument(@"../../Data/3333.pdf");
PdfLoadedPage lpage = pdf.Pages[0] as PdfLoadedPage;
PdfLoadedAnnotationCollection collection = lpage.Annotations;
for (int i = 0; i < collection.Count; i++)
{
PdfLoadedRectangleAnnotation rectAnnot = collection[i] as PdfLoadedRectangleAnnotation;
RectangleF bounds = rectAnnot.Bounds;
}
As per your requirement, we have created a sample to get the rectangle coordinates by using the above snippet. Please find the sample from the below link,
Sample link: http://www.syncfusion.com/downloads/support/directtrac/166329/ze/SampleWPF818699923
Please try this sample and let us know whether it meets your requirement. Otherwise kindly provide the specific details to us such as screenshot of your required output, sample you have used and other details (if any). It will be helpful for us to analyze more and to provide you better resolution.
Regards,
Pavithra D.
Upvotes: 1