cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

create a toolbar button to a pdf

bfriesen
16-Pearl

create a toolbar button to a pdf

Good afternoon, I am looking for guidance on how to create a toolbar button in editor that when pressed will open  specific pdf. How do I do this?

 

Bryon

1 ACCEPTED SOLUTION

Accepted Solutions

Bryon, it turns out execute() is not the command, see if the following works for you?

sh cmd /c start "" "c:\\src\\test test.pdf"

 

Once you get that command working then you will need to see how to add a toolbar button, so get that much working first with a test PDF.

View solution in original post

5 REPLIES 5

I haven't done this type of thing for a while but it should only take you an hour or so to figure out:

1. You will want to "shell out" or exec the following: start "" "c:\my\path\file.pdf" (if you type that command in to Windows command prompt it should open the PDF)

2. Figure out the ACL command for shelling out to command line, perhaps it is exec? Just look it up in the ACL command reference. You can test your full command from the ACL command line that is enabled in the Arbortext preferences. It may be something like (not tested): exec("start \"\" \"c:\\my\\path\\file.pdf\"")

3. Figure out how to add a toolbar button. It should be documented. For menus there is a menuloadhook you attach your code to, perhaps there is a toolbarloadhook too? The toolbar button then calls the ACL command you tested working at step #2.

Thanks Gareth, this is a whole new world for me.

I have successfully got my pdf to open at the windows command line.

start "c:\test.pdf"

 

I then searched the ACL ref guide (https://www.ptc.com/support/-/media/F0978608A44A4E7493ED9572BE7590C7.pdf?sc_lang=en) for exec, but it does not come up but execute does. In editor I tried

exec("start \"\" \"c:\\test.pdf\"") and execute("start \"\" \"c:\\test.pdf\"")

for exec I get and unrecognized function call error and it repeats the code I entered.

 

Thanks

Bryon

 

 

Bryon, it turns out execute() is not the command, see if the following works for you?

sh cmd /c start "" "c:\\src\\test test.pdf"

 

Once you get that command working then you will need to see how to add a toolbar button, so get that much working first with a test PDF.

Thanks Gareth, that seems to work when trying to open my test pdf. We do have a current tool bar that our consultants implemented at one time. I have found it in our application, in the dialogs folder. I looked at the buttons that they had done and followed their example.

I have added the following line:

<button Command="sh cmd /c start "" "c:\\test.pdf"
fontposture="italic fontstyle="sanserif" foregroundcolor="FF0000"
id="authorguide" label="Authoring Guide"
statustext="Authoring Guide"
tiptext="This opens the Authoring Guide"></button

 

But it does not seem to show up on the toolbar yet.

 

Thanks 

Bryon

Just got it to work. I had opened the xml in notepad++ and made the changes there. Once I opened the file in xml in editor and made the changes there, it now works.

Thank you gareth, I have added a sample of the file in my dialogs folder not sure how it is called to show up in editor though.

 

Bryon

 

 

Top Tags