Feature Request: Copy bookmarks/contents as text

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
Ludwig
User
Posts: 17
Joined: Sun Feb 24, 2013 1:52 pm

Feature Request: Copy bookmarks/contents as text

Post by Ludwig »

Hi there,

at the moment it is possible to copy the bookmarks/contents-structure and to paste it into another document. I would also like to have the option to copy this structure as simple text to the clipboard in order to paste it into another application (text-document or my reference management software for instance). Can this be realised?

Thanks
Ludwig
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Feature Request: Copy bookmarks/contents as text

Post by Ivan - Tracker Software »

Hi Ludwig,

it easily can be done using simple JavaScript (see below; it is taken from PDF JS Reference). When your document is active, open the JavaScript console (press Ctrl+J shortcut), paste the proposed JS code in the console and run it (using corresponding button on the toolbar). When script is finished, you will have a dump of all your boomarks in a plane text, and can select it, copy and use whenever you need.

HTH

Code: Select all

function DumpBookmark(bkm, nLevel)
{
  var s = "";
  for (var i = 0; i < nLevel; i++) s += " ";
  console.println(s + "+-" + bkm.name);
  if (bkm.children != null)
    for (var i = 0; i < bkm.children.length; i++)
      DumpBookmark(bkm.children[i], nLevel + 1);
}
console.clear(); console.show();
console.println("Dumping all bookmarks in the document.");
DumpBookmark(this.bookmarkRoot, 0);
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Ludwig
User
Posts: 17
Joined: Sun Feb 24, 2013 1:52 pm

Re: Feature Request: Copy bookmarks/contents as text

Post by Ludwig »

Works great - thanks a lot!
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: Feature Request: Copy bookmarks/contents as text

Post by Will - Tracker Supp »

:)
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
kotlmg
User
Posts: 1
Joined: Wed Oct 20, 2010 4:42 am

Re: Feature Request: Copy bookmarks/contents as text

Post by kotlmg »

in the same way is there any code to copy each line of text file as bookmark in pdf file.
for each line there should be one bookmark in pdf.

thanks a lot in advance.
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: Feature Request: Copy bookmarks/contents as text

Post by Will - Tracker Supp »

Hi kotlmg,

I don't personally believe that this is possible, programatically, but I will ask one of the Developers to weigh in, as they would know far than myself.

It's about 11pm (Sunday) for them, so it will be a few hours until they are able to comment.

Cheers,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Feature Request: Copy bookmarks/contents as text

Post by Ivan - Tracker Software »

JavaScript in PDF has no access to external files, so, it cannot read external text file.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Post Reply