Extract area as graphic?

3 posts, 1 answers
  1. James
    James avatar
    119 posts
    Member since:
    Mar 2009

    Posted 05 Mar Link to this post

    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. Answer
    Georgi
    Admin
    Georgi avatar
    44 posts

    Posted 08 Mar Link to this post

    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.
  3. James
    James avatar
    119 posts
    Member since:
    Mar 2009

    Posted 08 Mar in reply to Georgi Link to this post

    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.

Back to Top