Page 1 of 1

Change Object color on click

Posted: Tue Jun 13, 2017 10:37 am
by Anderl
Hello,
My first post here, salutations.
Currently using PDF-Xchange editor in demo mode. Build 319.0
I have a pdf file edited/exported from CorelDraw. I can select objects (e.g. rectangle) using the "Edit content" tool, and change its properties, but I'm wondering if there is a way to change the fill color by clicking on it. Colour should change alternatively between green and red on every click. Can I get the Element Id and change its properties using javascript?
Thanks in advance.

Re: Change Object color on click

Posted: Tue Jun 13, 2017 11:32 am
by Tracker Supp-Stefan
Hello Anderl,

Welcome to our forums, and thanks for your enquiry.
There's no such tool unfortunately, and as far as JS inside PDF files is concerned - it has access to the annotation objects in the document, but not to the base content elements - so it can't even theoretically be used for this automation you want.

If there would be many objects that need to be modified - why not select a few at a time (with the Ctrl key + mouse clicks) - and only then change the colour?

Regards,
Stefan

Re: Change Object color on click

Posted: Tue Jun 13, 2017 12:00 pm
by Anderl
Thanks Stefan for your reply.

Well... what I really want to do, is to link object properties (e.g. rectangle fill color) with the value of some text fields (e.g. red if text field value < 0; green if text field value > 0).
There is really no option of doing something like that?
Regards.

Re: Change Object color on click

Posted: Tue Jun 13, 2017 12:12 pm
by Will - Tracker Supp
Hi Anderl,

Can you send a sample document and advise on the content within it you're looking to change? If we can see an example, we should then be able to advise on some way that this could be done.

Cheers,

Re: Change Object color on click

Posted: Tue Jun 13, 2017 1:54 pm
by Anderl
Of course Stefan, thank you for your interest. Please, see attached doc.
I want to place some Text Fields (using the Edit Form tool) in the "VALUE" column and link that value with the corresponding objetc, so that its Fill color should become green if value < 0, and red if > 0.

Re: Change Object color on click  SOLVED

Posted: Tue Jun 13, 2017 2:24 pm
by Tracker Supp-Stefan
Hello Anderl,

Thanks for the sample file.
Those sections of your diagram are just vector paths - they do not have any unique names, and there are no provisions in the PDF specification to control these through JS.
You can create a logic for a text form field that can exxecute some JS and perform some operations - but those have to be e.g. on other form fields (as those have unique names) - but you can't have a form field with the shape and size you need.
I do not think we have the tools needed for you to create this interactivity.

Regards,
Stefan

Re: Change Object color on click [SOLVED]

Posted: Tue Jun 13, 2017 2:41 pm
by Anderl
Hello Stefan,
What a pity... but it's exactly what I imagined, since I was unable to locate an unique ID for those vector paths.
Anyway, thank you so much for your time.
Best regards,
Anderl

Re: Change Object color on click

Posted: Tue Jun 13, 2017 3:16 pm
by Tracker Supp-Stefan
Hello Anderl,

Sorry I could not find a solution for you!

Cheers,
Stefan