This is a migrated thread and some comments may be shown as answers.

Extract area as graphic?

2 Answers 60 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 05 Mar 2019, 01:52 PM

Hi,

We've been using the pdf viewer for years, and a new requirement has arisen around extraction of data. What we'd like to do is to allow users to draw a box around an area of the pdf on screen, and to export that area as a graphic (jpg / png etc).

Is this possible? I've had a look at the forums etc, but can't see that this question has been asked before.

(What we'd like to do in particular, is draw a box around a table and then use this API to parse the image and return structured data to us: https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/ )

Thanks, James.

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 08 Mar 2019, 12:15 PM
Hello James,

In order to achieve the desired result, you can obtain the coordinates on mouse click. After this, you can take a snapshot of RadPdfViewer using the RadBitmap class and crop the bitmap instance using the obtained coordinates, for example:
RadBitmap image = new RadBitmap(this.pdfViewer);
image = image.Crop(
    snapshotCropRangeX,
    snapshotCropRangeY,
    snapshotCropRangeWidth,
    snapshotCropRangeHeight);

I hope this helps.

Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
James
Top achievements
Rank 1
answered on 08 Mar 2019, 12:41 PM

Thanks Georgi, I'll give that a go. (I found a way of getting the whole page, but having just the selection would be good.)

James.

Tags
PDFViewer
Asked by
James
Top achievements
Rank 1
Answers by
Georgi
Telerik team
James
Top achievements
Rank 1
Share this question
or