How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Brandon M. Your Own Question

Brandon M.
Brandon M., Computer Support Specialist
Category: Microsoft Office
Satisfied Customers: 6971
Experience:  10+ Years Mac Support as contractor and currently an System Administrator for law firm
Type Your Microsoft Office Question Here...
Brandon M. is online now
A new question is answered every 9 seconds

I am using Excel 2010 to Convert a file to PDF. It automatically

Resolved Question:

I am using Excel 2010 to Convert a file to PDF. It automatically creates bookmarks based on the workbook tab names. The problem is that the tabs have a limitation of 31 characters max and we would like the bookmarks to be longer and more descriptive. I wanted to know if it is possible to rename the bookmarks to strings that I specific. For example, if I had a bookmark name "One", then when I open PDF I would like to rename this to be "Worksheet One Analysis on Much More Detailed Information Here We go".?
If this is possible, I would like you to write the Javascript for me for this example so that I can learn how to do this. I have a very easy test.pdf file that we can use for this purpose. Then, I would just need to know where to put the script to have it run when the PDF is open, or if I just want to run it on demand.
Submitted: 1 year ago.
Category: Microsoft Office
Expert:  Brandon M. replied 1 year ago.

BeBoo :

Welcome back and thanks for requesting me.

BeBoo :

Could you send me any files you have so that I can fully understand the question? You can upload them to http://www.wikisend.com/ - Just need the File ID or URL after you upload the file(s).

Customer:

I just upload the test.pdf file, but if you want to look at the excel one I can send that too. You will see some simple bookmark names. These are not descriptive enough, but at least they carry the page links. I have specific longer names for each of these Bookmarks. I want to know if you can write javascript to change the bookmark names to what we want.

BeBoo :

Do you have the FIle ID or URL for it?

BeBoo :

It might be possible but if you had a sample to work with, it would be great.

Customer:

test.pdf

Customer:

Let me know if you need anything else or have questions.

BeBoo :

Do you have either Acrobat Standard or Pro?

Customer:

I have Acrobat Pro

BeBoo :

Great, thanks. How would you like to work out the renaming? Would you like it to just ask you a new name for each tab?

Customer:

The pdf file created by excel is going to be run many times as it is a template where data is changed with different clients. The name of the Workbook tabs and the Longer Name are both fixed. For example, bookmark "One" would have a name much longer such as "Overall Analysis Page One Facility Side-By_Side Comparison". So, it would be best if the program was set up to recognize the old Bookmark name, and replace with the fixed string text.

Customer:

There may be as many as 25-30 bookmarks. Once I see how the code is written, I am hoping that I could revise it. At the moment, I am looking at just the top level. I am also interested in learning how to add one layer to the bookmarks. Then, I just need to figure out the best approach to run the code.

BeBoo :

Perfect. I will setup a few and you will be able to copy/paste to add more.

BeBoo :

Great. I have it setup as an action for you. Which means all you would have to do is open the PDF, go to Tools then Actions and then click Rename Bookmarks (then start). Here is the file: http://www.wikisend.com/download/488312/Rename%20Bookmarks.sequ

BeBoo :

If you are not familiar with actions, just double-click that file and Acrobat will ask if you want to import the action. Once you have it imported, you should see it on the right under Tools, Action Wizard.

BeBoo :

To edit it, click Manage Actions. Choose the Rename Bookmarks and click Edit. Click the Execute Javascript option on the right and then Properties

BeBoo :

err, Specify Settings, not properties.

BeBoo :

You'll see the script. It's pretty simple and hopefully you are able to understand it. The only thing you really need to change is to keep adding case statements. As you will see, there are already four there (0-3). Make sure to add new ones ABOVE the default line.

BeBoo :

As far as the default case, it will ignore any numbers you dont have listed. So, as an example, if you wanted it to skip bookmark 5 (case 4), just don't put a case 4 in and it will ignore it.

BeBoo :

Did you have a chance to try this out?

Customer:

Going to try this out now. I got caught up with work.

Customer:

How do you actually run the code?

Customer:

Oh, do you just double click on the action Name? Just curious, is there a way to make an action like this run automatically when a pdf is opened?

BeBoo :

No, that won't be possible.

BeBoo :

Did it work for you?

Customer:

So you cannot run an action automatically when opening a pdf.

Customer:

Definitely worked. It is awesome.

BeBoo :

Perfect. Glad it worked. Do you understand the code to be able to expand it yourself?

Customer:

Yes. I though it was possible to expand the Root Bookmarks and have others under them. In your code, I am guessing "bm.children.name " refers to the root bookmark. do you know offhand what a bookmark falling under this would have for syntax?

BeBoo :

bm is the root, .children refers to the nth instance of a bookmark (or child).

BeBoo :

.name is XXXXX XXXXX

BeBoo :

Basically, the children are the actual bookmarks

BeBoo :

.name refers to the name of it.

BeBoo :

There are probably other things you could get/set like where it links to (what page, etc)

BeBoo :

Those are the properties you can get/set

BeBoo :

If you wanted a sub-bookmark, you would want another for loop (different variable) and loop though bm.children.children (and reference bm.children.children[x].name - assuming the new for loop used x

Customer:

So if you had something like this. BM1 followed by subcategories BM1a and BM1b, then BM2 followed by subcategories BM2a and BM2b. Would the i just increment straight down so that BM1=1 BM1a=2 , etc?

BeBoo :

If that makes sense

BeBoo :

BM1 would essentially be bm.children[0], BM1a would be bm.children[0].children[0]

BeBoo :

BM1b would be bm.children[0].children[1]

BeBoo :

Does that make sense?

BeBoo :

The for loops just make it easier than specifying them manually

Customer:

Ohh. so children[0] is like the first level. Then you just add .children[#] to it for another level. Yes this makes sense. I think we are good to go. Thanks for all your help.

BeBoo :

Exactly.

BeBoo :

Glad I could help!

BeBoo :

I hope I have been helpful in today's session. It has been a pleasure working with you. Please be sure to rate the service you received today. You may also provide a tip after rating, if you feel I deserve one (thank you in advance!). Should you wish to request me in the future, you can bookmark/favorite my profile page by clicking my name on the left. Have a great rest of your day.

Brandon M., Computer Support Specialist
Category: Microsoft Office
Satisfied Customers: 6971
Experience: 10+ Years Mac Support as contractor and currently an System Administrator for law firm
Brandon M. and 4 other Microsoft Office Specialists are ready to help you

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • jstinehelfer

    Information Systems Manager

    Satisfied Customers:

    36
    A+ Comptia Certified computer repair
< Last | Next >
  • http://ww2.justanswer.com/uploads/JS/jstinehelfer/2012-6-6_215146_Pictureofme1.64x64.png jstinehelfer's Avatar

    jstinehelfer

    Information Systems Manager

    Satisfied Customers:

    36
    A+ Comptia Certified computer repair
  • http://ww2.justanswer.com/uploads/JA/JasonJames122/2011-12-16_135647_jasonjamesheadshotweb.64x64.jpg JasonJames122's Avatar

    JasonJames122

    Computer Enthusiast

    Satisfied Customers:

    0
    I manage all information systems (network of Windows PC's and servers with Microsoft Office products) for a small business
  • http://ww2.justanswer.com/uploads/JE/jessmagz/2012-6-6_18129_jm.64x64.jpg Jess M.'s Avatar

    Jess M.

    Computer Support Specialist

    Satisfied Customers:

    301
    Computer Software Specialist for more than 10 years
  • http://ww2.justanswer.com/uploads/CH/chutz747/2011-11-6_14231_me.64x64.jpg The-PC-Guy's Avatar

    The-PC-Guy

    Computer Manager

    Satisfied Customers:

    274
    20 years experience providing remote computer support
  • http://ww2.justanswer.com/uploads/SP/spherrod/2012-6-6_174244_1000852.64x64.JPG Steve Herrod's Avatar

    Steve Herrod

    Computer Support Specialist

    Satisfied Customers:

    125
    Trained in Microsoft Office from 2000 through to latest version 2010.
  • http://ww2.justanswer.com/uploads/SE/Seashore2011/2011-12-6_33418_111205223015.64x64.jpg Chris L.'s Avatar

    Chris L.

    Support Specialist

    Satisfied Customers:

    124
    Certified Expert with over 10 years experience.
  • http://ww2.justanswer.com/uploads/KR/krkljatorm/2012-6-24_153417_ITMiro.64x64.jpg IT Miro's Avatar

    IT Miro

    Computer Scientist

    Satisfied Customers:

    97
    Bachelor's Degree in Information Technology, Microsoft Certified Professional