diff --git a/src/main/java/org/jabref/logic/importer/OpenDatabase.java b/src/main/java/org/jabref/logic/importer/OpenDatabase.java index a47ab79be74..67563ae3684 100644 --- a/src/main/java/org/jabref/logic/importer/OpenDatabase.java +++ b/src/main/java/org/jabref/logic/importer/OpenDatabase.java @@ -6,11 +6,13 @@ import java.util.List; import org.jabref.logic.importer.fileformat.BibtexImporter; +import org.jabref.logic.importer.fileformat.PdfContentImporter; import org.jabref.logic.l10n.Localization; import org.jabref.logic.specialfields.SpecialFieldsUtils; import org.jabref.migrations.ConvertLegacyExplicitGroups; import org.jabref.migrations.ConvertMarkingToGroups; import org.jabref.migrations.PostOpenMigration; +import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.entry.BibEntry; import org.jabref.model.util.FileUpdateMonitor; @@ -64,8 +66,18 @@ public static ParserResult loadDatabase(String name, ImportFormatPreferences imp */ public static ParserResult loadDatabase(File fileToOpen, ImportFormatPreferences importFormatPreferences, FileUpdateMonitor fileMonitor) throws IOException { - ParserResult result = new BibtexImporter(importFormatPreferences, fileMonitor).importDatabase(fileToOpen.toPath(), - importFormatPreferences.getEncoding()); + + //pdf integration for getting the bibliography + + ParserResult result; + if(fileToOpen.getName().endsWith(".pdf")){ + result = new PdfContentImporter(importFormatPreferences).importDatabase(fileToOpen.toPath(), + importFormatPreferences.getEncoding()); + } else{ + result = new BibtexImporter(importFormatPreferences, fileMonitor).importDatabase(fileToOpen.toPath(), + importFormatPreferences.getEncoding()); + } + if (importFormatPreferences.isKeywordSyncEnabled()) { for (BibEntry entry : result.getDatabase().getEntries()) {