Plugin with similar functionality to snapshot tool

Ask a Question related to Adobe Acrobat SDK, Design and Development.

  1. #1

    Default Plugin with similar functionality to snapshot tool

    I would like to develop a plugin with functionality similar to the Acrobat snapshot tool. I'd like to provide a method for the user to select a rectangular region, and capture an image of that region to the clipboard, which is exactly what the snapshot tool does (I also want to add some features not provided by the snapshot tool once this is working). I've reviewed the SDK samples, and I'm not sure how to get started. Is this a special case of a Selection Server? Which API methods allow me to get the image of the rectangular selection, rather than iterating through PDF elements contained within?

    Thanks!
    Steve_J_Willis@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Use acrobat standard tool in custom annotation plugin
      Hello, want to develop a custom annotation plugin to draw a line or a polyline. Therefore i'd like use the standard tools like Pencil and...
    2. Does Acrobat Browser plugin allow full Adobe Acrobat 7.0 functionality
      Hello, currently I’m starting a new project. I have to design and implement a document retrieval system. The document format is PDF. The...
    3. snapshot
      I need to get a snapshot of the Hardware configuration of my pseries, Which command would help me in this issue? I need to know CPU model no. and...
    4. Snapshot on a Snapshot
      In article <bdcc590d.0212101011.3acce77e@posting.google.com>, aennen@amdocs.com says... It certainly is in 9i, but unfortunately you didn't...
  3. #2

    Default Re: Plugin with similar functionality to snapshot tool

    Your best bet is to render the page (or a portion of it) to an offscreen bitmap and then work from that.
    Leonard_Rosenthol@adobeforums.com Guest

  4. #3

    Default Re: Plugin with similar functionality to snapshot tool

    Hi Leonard,

    Thanks for the quick reply! Let me break down the areas I'm still unclear on into a couple of questions:

    (1) What is the best way to allow the user to draw a rectangular selection? Are there some callback functions I should implement to allow the user to click and drag a marquee, or do I have to handle the code to draw the rectangle myself? I'm wondering, for example, if I need to implement the drawing code as part of a custom AVTool DoClickProcType callback, or if there is a better, built in way to get a rectangular area that a user has drawn (given that this operation is common to many tools).

    (2) Once I have the rectangular selection coordinates from #1 above, how do I render it to an offscreen bitmap as you suggested? Is there a function in the API that allows me to do this?

    Thanks again!

    Steve
    Steve_J_Willis@adobeforums.com Guest

  5. #4

    Default Re: Plugin with similar functionality to snapshot tool

    Yes, custom AVTool with DoClickProc. There is an AV API that will handle the tracking for you (don't recall name offhand).

    Look at the PDPageDrawXXX APIs for rendering to offscreen...
    Leonard_Rosenthol@adobeforums.com Guest

  6. #5

    Default Re: Plugin with similar functionality to snapshot tool

    Thanks for the help! I have this working close to the way I need.

    I am now using AVPageViewDragOutNewRect to allow the user to select a rectangular region, then AVPageViewDrawRectOutline to draw the outline of the user's selection to the screen. I want to allow the user to select multiple rectangular regions, perhaps on different pages. However, AVPageViewDrawRectOutline uses device space coordinates, so all selected rectangles are drawn on every page, regardless of the page they were originally selected from by the user. Is there a way to draw rectangular areas only on specific pages? These rectangles are supposed to be temporary and not a modification to the document, so I want to avoid annotations.

    Steve
    Steve_J_Willis@adobeforums.com Guest

  7. #6

    Default Re: Plugin with similar functionality to snapshot tool

    Never mind. I have determined that Acrobat will set the page number in the current AVPageView before drawing each page. In the callback function registered for page view drawing events, simply comparing the page number returned by AVPageViewGetPageNum with the page of the rectangle to be drawn appears to work correctly (if they are not equal, don't draw the shape). Of course, this means the original page number of each drawing needs to be saved along with the rectangle, which I am accomplishing using a vector of structs.

    Thanks again for all the help to date!

    Steve
    Steve_J_Willis@adobeforums.com Guest

  8. #7

    Default Re: Plugin with similar functionality to snapshot tool

    I am having some issues implementing Leonard's suggestion above. It appears that PDPageDrawContentsToMemory() is only available from the PDF Library, not the standard Acrobat SDK. I'm trying to accomplish the equivalent of the built-in snapshot tool--that is, copy the image of a rectangular area on a page to the clipboard (or a jpeg, or whatever). Does the SDK provide any functions for accomplishing this?

    Thanks!

    Steve
    Steve_J_Willis@adobeforums.com Guest

  9. #8

    Default Re: Plugin with similar functionality to snapshot tool

    There are a set of PDPageDrawContentsXXX APIs that are available for plugins...
    Leonard_Rosenthol@adobeforums.com Guest

  10. #9

    Default Re: Plugin with similar functionality to snapshot tool

    Thanks again for the help! I now have this nearly working.

    I'm using PDPageDrawContentsToWindow to draw to an offscreen DC. This works fine. However, I want to limit what is drawn to the rectangle the user selected, which I store as an ASFixedRect. When I pass this to PDPageDrawContentsToWindow as the updateRect parameter, the entire page is still drawn with the same origin. I've also experimented with passing some invalid ASFixedRect values, and still the entire page is drawn. It seems like the updateRect parameter is being ignored (the default when this parameter is NULL).

    Any advice?

    Thanks!

    Steve
    Steve_J_Willis@adobeforums.com Guest

  11. #10

    Default Re: Plugin with similar functionality to snapshot tool

    Are you sure you are passing the coordinates in rotated user-space and not device-space? Have you also tried PDPageDrawContentsToWindowEx?
    PDL@adobeforums.com Guest

  12. #11

    Default Re: Plugin with similar functionality to snapshot tool

    The coordinates are certainly in user space, though I don't know what is meant by "rotated". The same ASFixedRect is also used to select text within the chosen area, and the selected text corresponds to the expected rectangular area. Even if my coordinates are wrong, I would expect only objects within the (incorrect) rectangle to be drawn per the documentation--not the entire page. As a test, I created an ASFixedRect with no dimension (zero for all values). Still, the entire page was drawn.

    PDPageDrawContentsToWindowEx just calls PDPageDrawContentsToWindow, but allows control of the display flags. The result of calling this function is the same.

    Any other thoughts?

    Steve
    Steve_J_Willis@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139