0
votes

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

enter image description here thank you.

1
Is this question related to stackoverflow.com/questions/40126232/… and if yes, how exactly? It looks like you are asking several questions about one project you're working on. It's good that you split it up in several pieces, but it might be helpful if you gave a bit of background information.Amedee Van Gasse
Your rectangles are added to the document as Square annotations. Thus, you merely have to inspect the annotations of the page, retrieve these annotations, and get the coordinates from the annotation objects.mkl

1 Answers

1
votes

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.