开发者

What type of annotation (or other object) to use?

开发者 https://www.devze.com 2023-01-29 06:19 出处:网络
I\'d like to take an existing PDF and add semi-transparent rectangles on top of the pages, at pre-defined locations.When the user moves the mouse over the rectangle, it should change color and/or tran

I'd like to take an existing PDF and add semi-transparent rectangles on top of the pages, at pre-defined locations. When the user moves the mouse over the rectangle, it should change color and/or transparency. I should be able to define different colors (including transparency) for both states. Clicking on it executes some action that I define (such as going to another page, or a website).

I understand that this can be done with annotations, 开发者_开发技巧but I'm having trouble figuring out which type of annotation would be best suited. They also don't seem to handle transparency very well. Of course, I'm open to using something other than annotations, if need be...


1) That would have to be annotations. If it's clickable-and-does-something, it's an annotation. It could be an annotation on top of some page content, but an annotation must be involved.

2) You can set the appearance of a button to be arbitrary PDF content, including "normal" and "mouse-over" appearances. Note that these appearances aren't available through the Acrobat UI, but can be accessed programmatically from your API of choice at the object level. All appearance dictionaries have 3 different states: "N"ormal, "R"ollover, and "D"own.

To be honest, I've never tried setting a form field's rollover (or down for that matter) appearance, so I'm not sure how well that will work, but the Theory is sound.

What's the difference between theory and practice? In theory, there's no difference between theory and practice. Ouch.

You didn't specify a programming language/os/anything, so it's not possible to give more detail.


Use a button with an ICON appearance and a transparent background. The icon is an arbitrary PDF content stream with resources. Within it, you can set transparency just like you would as part of a page content stream. In fact, the only way the acrobat gui lets you pick an icon is to select a page from an existing PDF document.

Alternatively you might also be able to set the widget's /DA to use transparency with an extended graphic state resource that you'd add to the Acroform's DR dictionary. I haven't tried that myself.

0

精彩评论

暂无评论...
验证码 换一张
取 消