# Add entry using PDFs

## Adding using drag and drop

{% hint style="info" %}
The simplest way to create a new entry based on a single PDF file is to drag & drop the file onto the table of entries (between two existing entries). JabRef will then analyze the PDF and create a new entry.
{% endhint %}

If you drop a PDF onto an entry in the main table or the entry preview in the entry editor, the PDF is simply attached to the entry. To add a new entry based on the PDF meta data, drop it **between** two entries in the main table or onto the empty area in the maintable (available for small libraries). The meta data of the PDF is then parsed and a new entry is added to the library. The PDF file is moved and renamed to the library as default. If you want to copy or just link it, hold the respective modifier keys. On Windows, Ctrl is for copying and Alt is for linking.

### Better filenames

JabRef changes the filenames automatically. You can adapt the pattern at Preferences -> Import ![Preferences - Import](https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-991e40764e20499c452e3a6d2cc815e1ec17cf98%2Fpreferences-import.png?alt=media)

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

This makes the filenames start with the citation 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.

More details are given at [Managing Linked Files](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks).

## Adding files currently not linked in the library

In case you have numerous PDF files and want to convert them into new entries, JabRef can search automatically for the PDF files, let you select the relevant ones, and convert them into new entries.

This feature is available through **Lookup -> Search for unlinked local files**.

### 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/setup/citationkeypatterns).

### Using the Wizard "Search for unlinked local files"

{% hint style="warning" %}
This information is partially outdated. Please help to improve it ([how to edit a help page](https://docs.jabref.org/contributing/how-to-improve-the-help-page#editing-help-pages-directly-in-the-browser)).
{% endhint %}

1. Create or open a library (AKA a `.bib` file).
2. Go to **Lookup -> Search for unlinked local files**. (or press `SHIFT + F7`)

   ![FindUnlinkedFiles - Menu](https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-1689f9b21d8cbf54cff99126f5d04435bf6386a0%2Fbildschirmfoto-2021-07-05-um-19.19.09.png?alt=media\&token=d7c03647-79aa-4921-b59e-32523a441a85) ![FindUnlinkedFiles - Menu](https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-629dc3b9d81d93bb42310bd5caa6ad150c32f2a0%2Ffindunlinkedfiles-menu-5.2.png?alt=media)
3. The "Search for unlinked local files" dialog opens.

   <img src="https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-788c9e0a94f928021454d0f388e758ac3121a5c0%2Ffindunlinkedfiles-window-5.2.png?alt=media" alt="FindUnlinkedFiles - Initial dialog" data-size="original">
4. Choose a start directory using the "Browse" button.
5. Click on "Search" / "Scan directory".
6. In "Select files", the files not yet contained in the library are shown.

   <img src="https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-8b1f0c4f2c78914c7c72be0ffd096a00bf3bcd5f%2Ffindunlinkedfiles-foundfiles-5.2.png?alt=media" alt="FindUnlinkedFiles - Found files" data-size="original">
7. Select the entries you are interested in. Note: the button `Export selected files` allows you to export the list of the selected files (a text file containing on each line one filename with its path)
8. Click on `Import`.

   The windows close and the entry table now contains the newly-imported entries.
9. The entry editor with the last imported entry is shown ![FindUnlinkedFiles - 08 - entry editor](https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-c4a0e80ab684e2049b1715cb2f17848d850af353%2Ffindunlinkedfiles-08-entry-editor.png?alt=media)
10. You can now save the file and are finished.
11. Optional: Click on "General" to see the linked file ![FindUnlinkedFiles - 09 - entry editor - General](https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-8cb7a72ecbd13d4e3ec2c2d1ee92d531ae4d0297%2Ffindunlinkedfiles-09-entry-editor-general.png?alt=media)
12. Optional: Click on "BibTeX source" to see the BibTeX source ![FindUnlinkedFiles - 10 - entry editor - BibTeX source](https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-6fd6e40f47b66c6e9f6c34e1b4a71d1dc6076994%2Ffindunlinkedfiles-10-entry-editor-bibtex-source.png?alt=media\&token=b7639e00-b4ff-4db4-9c63-f01d98f460b1)
13. 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://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-a121838ae7cd3e36d5922290c626660037e9f7de%2Ffindunlinkedfiles-11-entry-editor-shrunk.png?alt=media\&token=03227d49-83df-492e-8a8a-8d09c260ca40)
14. Optional: Press Esc to show the entry preview ![FindUnlinkedFiles - 12 - entry preview](https://2944476579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lr3JU9j9iSUW8RYz1hD-2910905616%2Fuploads%2Fgit-blob-8dd6ce7e70e3288928ecb123bce01b1da73a6f1d%2Ffindunlinkedfiles-12-entry-preview.png?alt=media\&token=06201e83-7031-42cf-b84d-b9914f549561)

{% hint style="danger" %}
The imported entries may need some editing because all the information gathered from the PDF files may not be accurate (see below "PDFs for which it works").
{% endhint %}

## How .gitignore affects “Find unlinked local files”

JabRef’s “Find unlinked local files” feature respects `.gitignore` files. A `.gitignore` file is a small text file where you list file names or patterns you don’t want to see; tools that support it (like Git and JabRef) skip those files during searches.

## What JabRef does

* Looks for an applicable `.gitignore` in the directory being scanned and applies its patterns.
* Interprets patterns relative to the directory that contains the `.gitignore`.
* Applies all patterns (not “first match wins”).
* Also ignores the `.git` directory and common OS metadata by default, and ignores the `.gitignore` file itself.

## Notes about pattern behavior

* Patterns are matched against the path relative to the `.gitignore`’s directory.
* Patterns like `ignore/*` and `ignore/**` work as in Git to ignore a named subdirectory and its contents.
* Patterns starting with `**/` (for example, `**/*.png`) also match files in the top directory for convenience, so PNGs are ignored both in subdirectories and at the base level.

## Examples

Ignore all PNG images everywhere:

```gitignore
*.png
```

Ignore a specific subdirectory named ignore (and everything inside, including nested folders):

```gitignore
ignore/*
ignore/**
```

Ignore PDFs in any subfolder (and also at the base directory):

```gitignore
**/*.pdf
```

## Tips

* Place a `.gitignore` file in the folder you start the search in (or deeper) to control what is scanned.
* If you use multiple `.gitignore` files in different subfolders, each one applies to the files under its directory.

This behavior mirrors Git’s expectations in practice, while making it straightforward to exclude unneeded files from the unlinked-files search.

## Further information

### PDFs for which it works

The importer works well if there is BibTeX on the first page of the PDF, 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.

Background:

* Embedding BibTeX inside PDFs is done by the [LaTeX authorarchive package](https://ctan.org/pkg/authorarchive)
* Having BibTeX on the first page is done by the [LaTeX CoverPage package](https://ctan.org/pkg/coverpage)
* Embedding BibTeX data [using XMP is available in JabRef](https://docs.jabref.org/advanced/xmp)
* Online parsing is enabled using the online service Grobid.

### 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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jabref.org/collect/findunlinkedfiles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
