# Add unlinked PDFs including BibTeX data into the database

This feature is available through **Quality → Find unlinked files...**.

The following description appeared first on [tex.stackexchange.com](http://tex.stackexchange.com/a/344310/9075).

## Preparation: Adjust the JabRef key generation pattern to fit your needs

JabRef offers a BibTeX key generation and offers different patterns described at [BibtexKeyPatterns](https://docs.jabref.org/v4/setup/bibtexkeypatterns).

## Link the PDFs to your bib file

1. Create or open a .bib file.
2. Go to "Quality" -> "Find unlinked files". ![FindUnlinkedFiles - 01 - menu](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-3b1d20d2f2a82d8304ea3ae8a89bfcae1b78bdf3%2Ffindunlinkedfiles-01-menu%20\(1\).png?alt=media)
3. The "Find unlinked files" dialog opens. ![FindUnlinkedFiles - 02 - initial dialog](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-5b0d1de339c28ec752b9a53030e7c5c9d379c280%2Ffindunlinkedfiles-02-initial-dialog%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)
4. Choose a directory using the "Browse" button.
5. Click on "Scan directory".
6. In "Select files", the files not yet contained in the database are shown. ![FindUnlinkedFiles - 03 - scan result](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-025745223993bcea4bbda092b66af377decc692e%2Ffindunlinkedfiles-03-scan-result%20\(1\)%20\(1\).png?alt=media)
7. To create entries for all files, click on "Apply".
8. For each file, an import dialog is shown ![FindUnlinkedFiles - 04 - metadata](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-d236a011f2a3db7eb5faff170e6367bd2d9a9973%2Ffindunlinkedfiles-04-metadata%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(1\).png?alt=media) The dialog shows the XMP metadata stored in the PDF in the area "XMP-metadata". If this data fits your needs, select "Create entry based on XMP data". Typically, the XMP-metadata is not good enough. Choose "Create entry based on content".
9. Click on "OK" to start the import
10. A dialog asking for the link is opened ![FindUnlinkedFiles - 05 - LinkToFile](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-78e4e3dd5496228e6a29c92fbe3d199481b65c33%2Ffindunlinkedfiles-05-linktofile%20\(2\)%20\(2\)%20\(2\)%20\(1\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\).png?alt=media) You can choose "Leave file in its current directory" to keep the file where it is. Typically, this is that what one wants. In case you choose "Move file to file directory", you can also choose to rename the file to the generated BibTeX key.
11. Press OK to link the file to the BibTeX entry
12. This happens for each file. After that, the "Find unlinked files" dialog is shown. Just click on "Close" to close it.
13. The entry editor with the last imported entry is shown ![FindUnlinkedFiles - 08 - entry editor](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-c4a0e80ab684e2049b1715cb2f17848d850af353%2Ffindunlinkedfiles-08-entry-editor%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(3\)%20\(2\).png?alt=media)
14. You can now save the file and are finished.
15. Optional: Click on "General" to see the linked file ![FindUnlinkedFiles - 09 - entry editor - General](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-8cb7a72ecbd13d4e3ec2c2d1ee92d531ae4d0297%2Ffindunlinkedfiles-09-entry-editor-general%20\(1\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(3\)%20\(2\).png?alt=media)
16. Optional: Click on "BibTeX source" to see the BibTeX source ![FindUnlinkedFiles - 10 - entry editor - BibTeX source](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-6fd6e40f47b66c6e9f6c34e1b4a71d1dc6076994%2Ffindunlinkedfiles-10-entry-editor-bibtex-source.png?alt=media)
17. Optional: You have to shrink it to see the entry in the entry table Enlarge the JabRef window and use the mouse at the upper border of the entry editor ![FindUnlinkedFiles - 11 - entry editor - shrunk](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-a121838ae7cd3e36d5922290c626660037e9f7de%2Ffindunlinkedfiles-11-entry-editor-shrunk.png?alt=media)
18. Optional: Press Esc to show the entry preview ![FindUnlinkedFiles - 12 - entry preview](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-8dd6ce7e70e3288928ecb123bce01b1da73a6f1d%2Ffindunlinkedfiles-12-entry-preview.png?alt=media)

## Further information

### PDFs for which it works

The importer based on the content has been written for IEEE and [LNCS](https://github.com/latextemplates/LNCS) formatted papers. Other formats are not (yet) supported. In case a DOI is found on the first page, the DOI is used to generate the BibTeX information.

The next development step is to extract the title of the PDF, use the "Lookup DOI" and then the [Get BibTeX data from DOI](https://docs.jabref.org/v4/finding-sorting-and-cleaning-entries/getbibtexdatafromdoi) functionality from JabRef to fetch the BibTeX data.

We are also [thinking about](https://github.com/koppor/jabref/issues/169) replacing the code completely by using another library. This is much effort and there is no timeline for that.

### Better filenames

JabRef also offers to change the filenames. You can adapt the pattern at Preferences -> Import ![Preferences - Import](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-991e40764e20499c452e3a6d2cc815e1ec17cf98%2Fpreferences-import%20\(1\)%20\(1\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(3\).png?alt=media)

Select "Choose pattern" and choose "bibtexkey - title" ![Preferences - Import - Choose pattern](https://1203621998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-4248753286%2Fuploads%2Fgit-blob-fa7600748ce705134d1d4e526b2631d01d9e3115%2Fpreferences-import-choose-pattern%20\(1\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(2\)%20\(3\)%20\(2\).png?alt=media) This results in the setting `\bibtexkey\begin{title} - \format[RemoveBrackets]{\title}\end{title}`.

This makes the filenames start with the bibtey key followed by the full title. In the concrete case, `\bibtexkey` only may be the better option as the described bibtey key already contains the title.

### Mr.DLib

JabRef used to have support for [Mr.DLib](http://mr-dlib.org/), which returned back a full BibTeX entry or a PDF. Due to unclear copyright situation of a used library, this service was removed. Further, Mr.DLib changes its focus and will provide literature recommendations. See [the realted articles tab](https://docs.jabref.org/v4/general/entryeditor#related-articles-tab).

### Related questions on stack overflow

* [Extract titles from each page of a PDF?](http://stackoverflow.com/q/18071127/873282)
* [Zotero: Extract references from PDF and create new library items from them](https://forums.zotero.org/discussion/16277/extract-references-from-pdf-and-create-new-library-items-from-them)
* [Is there an open source tool for producing bibtex entries from paper PDFs?](http://academia.stackexchange.com/questions/15504/is-there-an-open-source-tool-for-producing-bibtex-entries-from-paper-pdfs)
* [Extracting information from PDFs of research papers](http://stackoverflow.com/questions/1813427/extracting-information-from-pdfs-of-research-papers/3523416)
