PdfImporters are also org.jabref.logic.importer.Importer s,
which allows user for more fine-grained control of how org.jabref.model.entry.BibEntry is extracted from a PDF file.
PdfImporters are used in two places in JabRef:
PdfMergeMetadataImporter: uses several PdfImporter and automatically
merges them into 1 org.jabref.model.entry.BibEntry .
org.jabref.gui.externalfiles.PdfMergeDialog also uses several PdfImporter, but
it shows a merge dialog (instead of automatic merging).
Note, that this step should not add PDF file to org., it will be finally added either in
importDatabase(Path) or PdfMergeMetadataImporter.
The result might be the metadata of the given PDF or the list of references in the references section (also called "citations"). Each implementation should denote which of these two it supports.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public StandardFileType | getFileType()
Implements abstract org. Returns the type of files that this importer can read |
| public ParserResult | importDatabase(BufferedReader reader)
Implements abstract org. Parse the database in the source. |
| public ParserResult | importDatabase(String data)
Overrides org. Parse the database in the specified string. |
| public ParserResult | importDatabase(Path filePath)
Overrides org. Parse the database in the specified file. |
| public abstract ParserResult | importDatabase(Path filePath, PDDocument document)
Note The "throws" clause is for "developer convenience" - it is turned into a ParserResult at |
| public boolean | isRecognizedFormat(Reader input)
Overrides org. #isRecognizedFormat(BufferedReader) without the requirement to reset |
| public boolean | isRecognizedFormat(BufferedReader input)
Overrides org. Check whether the source is in the correct format for this importer. |
| PdfImporter | back to summary |
|---|---|
| public PdfImporter() | |
| getFileType | back to summary |
|---|---|
| public StandardFileType getFileType() Implements abstract org. Doc from org. Returns the type of files that this importer can read
| |
| importDatabase | back to summary |
|---|---|
| public ParserResult importDatabase(BufferedReader reader) throws IOException Implements abstract org. Doc from org. Parse the database in the source. This method can be called in two different contexts - either when importing in a specified format, or when importing in unknown format. In the latter case, JabRef cycles through all available import formats. No error messages or feedback is displayed from individual import formats in this case. If importing in a specified format and an empty library is returned, JabRef reports that no entries were found. If your format is binary-based (PDF, ZIP-based, or others), then you should not solely override this method. For binary formats do this:
| |
| importDatabase | back to summary |
|---|---|
| public ParserResult importDatabase(String data) throws IOException Overrides org. Doc from org. Parse the database in the specified string. Importer having the facilities to detect the correct encoding of a string should overwrite this method, determine
the encoding and then call
| |
| importDatabase | back to summary |
|---|---|
| public ParserResult importDatabase(Path filePath) Overrides org. Doc from org. Parse the database in the specified file.
| |
| importDatabase | back to summary |
|---|---|
| public abstract ParserResult importDatabase(Path filePath, PDDocument document) throws IOException, ParseException Note The "throws" clause is for "developer convenience" - it is turned into a ParserResult at | |
| isRecognizedFormat | back to summary |
|---|---|
| public boolean isRecognizedFormat(Reader input) throws IOException Overrides org. Doc from org. #isRecognizedFormat(BufferedReader) without the requirement to reset
| |
| isRecognizedFormat | back to summary |
|---|---|
| public boolean isRecognizedFormat(BufferedReader input) throws IOException Overrides org. Doc from org. Check whether the source is in the correct format for this importer. All implementations need to reset the input stream to the beginning again - to enable importing at subsequent calls. The effect of this method is primarily to avoid unnecessary processing of files when searching for a suitable import format. If this method returns false, the import routine will move on to the next import format. Thus, the correct behavior is to return false if it is certain that the file is not of the suitable type, and true otherwise. Returning true is the safe choice if not certain.
| |