Feature Request: Copy bookmarks/contents as text

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

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

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

Feature Request: Copy bookmarks/contents as text

Post by Ludwig » Thu Dec 12, 2013 8:18 pm

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

Ivan - Tracker Software
Site Admin
Posts: 3609
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 » Thu Dec 12, 2013 8:37 pm

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 » Thu Dec 12, 2013 9:27 pm

Works great - thanks a lot!

User avatar
Will - Tracker Supp
Site Admin
Posts: 6806
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 » Thu Dec 12, 2013 10:00 pm

:)
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 » Sat Dec 14, 2013 6:33 am

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: 6806
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 » Mon Dec 16, 2013 7:18 am

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

Ivan - Tracker Software
Site Admin
Posts: 3609
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 » Mon Dec 16, 2013 7:26 am

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