Skip to content

How can I export file name of pdf attachments #2311

Answered by retorquere
Seraphli asked this question in Q&A
Discussion options

You must be logged in to vote

This works for me

if (Translator.BetterTeX && item.attachments) {
  var filename = item.attachments
    .filter(att => att.localPath && att.localPath.match(/\.pdf$/i))
    .map(att => att.localPath.replace(/.*[\\/]/, ''))
    .find(att => att)

  tex.add({ name: 'filename', value: filename, enc: 'raw' })
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Seraphli
Comment options

Answer selected by Seraphli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants