Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

How to extract the list of named destinations

Guest
Jan 18, 2017 Jan 18, 2017

My team produces a software product with PDF help.  We create the PDF help in InDesign and use javascript to create automatic named destinations from the table of contents to be able to open the pdf help to specific locations from our program.

For some reason, InDesign attaches some random digits to the end of all of our named destinations.  They are not visible in the named destination list in InDesign, but when you export the pdf, they appear.  From what I can gather online, this is a new problem introduced in Creative Cloud 6 but I don't see any responses from Adobe regarding them acknowledging or fixing this problem.  Can you please address this?

As a work around, my team would like to deal with these random digits by extracting the list of named destinations from the pdf so we can link to them appropriately.  I see this question asked many times with no actual answers/help provided.  They say "use the sdk; it has examples."

I downloaded the SDK and have been going through the documentation and there are no examples for this.  It's very confusing because the documentation describes the file trailer and document catalog and name trees but the actual Acrobat TLB does not seem to have corresponding parameters/functions to access these.

Please, please, please, can someone from adobe provide some help in how to extract the named destinations?  This is a very big issue for my team and I think many other individuals.

TOPICS
Acrobat SDK and JavaScript
5.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 18, 2017 Jan 18, 2017

The full PDF structure is only available to plugins, in C/C++, which can use the Cos later to examine specific objects. Though a PDNameTree API might be more simple for the named destinations. The other APIs only offer packaged access to a tiny fraction of the PDF content; and the ability to write does not mean there's an ability to read.

Translate
LEGEND ,
Jan 18, 2017 Jan 18, 2017

The full PDF structure is only available to plugins, in C/C++, which can use the Cos later to examine specific objects. Though a PDNameTree API might be more simple for the named destinations. The other APIs only offer packaged access to a tiny fraction of the PDF content; and the ability to write does not mean there's an ability to read.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 18, 2017 Jan 18, 2017

As TSN says, you will need to write a plugin in C/C++ to get this info and the PDNameTree APIs (along with some Cos APIs) will achieve your goals.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 19, 2017 Jan 19, 2017

Thank you both for confirming that for me!  I was told by another developer that it was possible to do this without writing a plug in.  So at least now I'm headed in the right direction.  If I have to write a plug in anyway, I should probably just write a plug in to convert the bookmarks to named destinations and not do that step inside InDesign. 

Anyhow, I'm currently going through http://help.adobe.com/livedocs/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp... and have downloaded the SDK.  I see there are a lot of examples there, but it has been a very long time since I have used Visual Studio or C++.  Could you please tell me if my understanding of this process below is correct?

1.  In the SDK, I should install Acrobat XI SDK\PluginSupport\Tools\Visual Studio App Wizard\setup.exe which will install the right tool into Visual Studio for me to be able to write an adobe plugin?  (After I install, will something like "adobe plug in" show up in my options for a new project?)

2.  After thoroughly understanding the helpdocs above, I should use the sample code provided, like Basic Plugin, and try to create a .api file in Visual Studio.

3.  I should put the BasicPlugin.api file in the Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\plug_ins directory and then open up any pdf file.  The plug in will automatically load when acrobat launches?

4.  Assuming that all of this works properly, then I should be ready to write my own code for my named destination issue by modifying sample code provided in the sdk?

Thank you for your help with this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 19, 2017 Jan 19, 2017

You are correct with 2, 3, and 4. As far as #1 goes: You don't need the the App Wizard (it's not available for the Mac for example, and we can still build plug-ins on the Mac), but it makes things a bit more convenient. For a large project I worked on a while ago, I even created a new plug-in wizard that created plug-in templates with a lot of modifications that were required for that project. But again, you don't really need it - you can just copy and modify one of the existing sample plug-ins to start a new project.

You should start with the basic or the starter plug-in, understand what it does, and then modify that so that you - step by step - explore the plug-in API. Once you know how to compile plug-ins, and are ready to look at the more complex aspects of working with the plug-in API, you should compile and install the Snippet Runner, which allows you to look at a lot of sample code for different areas in the plug-in API.

Working with the plug-in API requires that you have a good understanding of the PDF format as well. You may also want to take a look at Leonard Rosenthal's book: Developing with PDF: Dive Into the Portable Document Format: Leonard Rosenthol: 9781449327910: Amazo...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 19, 2017 Jan 19, 2017

Thank you very much for that book suggestion!  I will definitely get my hands on a copy.  Could I please follow up with a few more questions?

1) In absence of the app wizard, how would you compile it specifically to a .api file?  That stands for adobe/acrobat plug in file, right?  So how does Visual Studio produce that output type without some kind of plug-in or tool provided by adobe?

2) Should it have been inherently obvious to me that I should look at the snippet runner?  I can't seem to find any kind of "meta" documentation explaining what the different sample projects attempt to accomplish.  So I have been randomly looking at different examples and the name "snippet runner" didn't mean much to me so I didn't even look at it until you mentioned it.

3) I apologize, I haven't done any kind of large scale cpp project, so I'm a bit confused on how to pull in these examples.  From reading the plugin introduction site, I think I need some of the headers in the Acrobat XI SDK\PluginSupport\Headers folder for some of the handshaking.  But that folder is provided separate, outside of the samples directory, so am I incorrect about that? I'm just surprised those headers aren't a part of each of the sample projects given.

4) So if I wanted to look at the sample snippet runner could I just copy the entire Snippet Runner directory into my working visual studio directory and then just open the .sln file?  Are the sample projects and directory setup such that everything is where visual studio would look for the associated .cpp and .h files?

I realize that I sound a little ridiculous asking some of these.  You're probably wondering "why don't you just try it and see if you can get it to work yourself?"  The thing is, I'm waiting for my system admins to approve putting the adobe sdk on our network, so right now I'm unable to do anything and don't want to waste even more time later.  So I figure if I get my bearings straight now, I can just get straight to work when I finally have the sdk available to me.

Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 19, 2017 Jan 19, 2017

#1 When you use one of the sample projects, they come with the project configuration files correctly set up to produce API files. Which means that when you copy and modify one of these projects, you automatically get these project configuration files as well, and your new project will (or should) also create an API file.

#2 The snipper runner will be a bit too much information for you if you have not yet compiled your first plug-in yet. The names of the plug-ins (with probably the exception of the snippet runner) will tell you what the plug-in does:

BasicPlugin - very basic plug-in

BatesNumbering - apply "Bates Numbers" do a document

DMSIntegration - integration with a document management system

DocSign - sign a document

Embed3dData - just as the name implies, embed 3D data in a PDF file

PDFBinder - create a PDF Binder or a PDF Portfolio

RplcFileSystem - Create and use a new filesystem

SelectionServer - create a selection server

ShowPermissions - show the permissions of the document

SnippetRunner - Display and run many different code snippets from all over the plug-in API

Stamper - place a stamp

Starter - Use this as the "starter" for our own plug-in

UncompressPDF - Uncompress compressed information in a PDF file

WeblinkDemo - Creates and regisgers a new weblink driver

wxPlugin - Uses a wxWidgets user interface

The description of what a plug-in does is usually in a comment in the first few lines of the corresponding "Init" file (e.g. WeblinkDemoInit.cpp for the WebLinkDemo plug-in).

#3 Yes, the headers are outside of the sample project folders - because they are used for all projects. This is the normal way of setting up C/C++ projects, where you include (link) external resources. All you should have to do is to open one of the project files (e.g. BasicPlugin.sln in PluginSupport\Samples\BasicPlugin\win32), and VS should do the rest.

#4 You need do copy not just the actual project directory, but also the Headers directory, and the Headers directory needs to be in the same relative location as it is in the SDK folder. What's easiest is to just develop right in the SDK folder, and create a folder named "MyPlugIns" right next to the "Samples" folder, then copy whatever plug-in you want to play with from Samples to MyPlugIns - this way, all the relative links are still working, and you don't have to "mess" with the project configuration.

Hope that helps.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 19, 2017 Jan 19, 2017

Thank you so much Karl! 

I think I have all my ingredients together to get started.  I also finally found the right documentation for the SDK which is making it easier to navigate now.

Okay, last question...I hope

Can you explain the distinction between a snippet and a regular plugin?  I saw one description somewhere but I didn't fully understand it.

For my purposes, I might want to take a look at the snippets provided since they give a lot of good examples in those cpp files, but I should probably create my own full-fledged, stand-alone plug in rather than try to create a snippet that could be incorporated into the snippet project?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 19, 2017 Jan 19, 2017

The Snippet Runner is your playground, where you can try things, but once you know what you are doing, you should put the functionality that you are creating into it's own plug-in.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 20, 2017 Jan 20, 2017

Thanks for all of your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 23, 2017 Jan 23, 2017
LATEST

Just wanted to say that I was able to successfully create a plugin to extract the named destinations, thanks to the help of this forum

I think I'll get adventurous now and try to automatically convert all of the bookmarks to named destinations!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines