diff --git a/src/main/java/org/jabref/logic/importer/fileformat/PdfContentImporter.java b/src/main/java/org/jabref/logic/importer/fileformat/PdfContentImporter.java index ca266e8c895..7d43be038a4 100644 --- a/src/main/java/org/jabref/logic/importer/fileformat/PdfContentImporter.java +++ b/src/main/java/org/jabref/logic/importer/fileformat/PdfContentImporter.java @@ -218,7 +218,7 @@ public ParserResult importDatabase(Path filePath) { private static String extractTitleFromDocument(PDDocument document) throws IOException { TitleExtractorByFontSize stripper = new TitleExtractorByFontSize(); - return stripper.getTitleFromFirstPage(document); + return stripper.getTitle(document); } private static class TitleExtractorByFontSize extends PDFTextStripper { @@ -230,9 +230,9 @@ public TitleExtractorByFontSize() { this.textPositionsList = new ArrayList<>(); } - public String getTitleFromFirstPage(PDDocument document) throws IOException { + public String getTitle(PDDocument document) throws IOException { this.setStartPage(1); - this.setEndPage(1); + this.setEndPage(2); this.writeText(document, new StringWriter()); return findLargestFontText(textPositionsList); } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTest.java index de6f276a015..318cb858508 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTest.java @@ -140,6 +140,7 @@ void pdfTitleExtraction(String expectedTitle, String filePath) throws Exception private static Stream providePdfData() { return Stream.of( Arguments.of("Fundamentals of Distributed Computing: A Practical Tour of Vector Clock Systems", "/pdfs/PdfContentImporter/Baldoni2002.pdf"), + Arguments.of("JabRef Example for Reference Parsing", "/pdfs/IEEE/ieee-paper-cover.pdf"), Arguments.of("On How We Can Teach – Exploring New Ways in Professional Software Development for Students", "/pdfs/PdfContentImporter/Kriha2018.pdf"), Arguments.of("JabRef Example for Reference Parsing", "/pdfs/IEEE/ieee-paper.pdf"), Arguments.of("Paper Title", "/org/jabref/logic/importer/util/LNCS-minimal.pdf"), diff --git a/src/test/resources/pdfs/IEEE/ieee-paper-cover.pdf b/src/test/resources/pdfs/IEEE/ieee-paper-cover.pdf new file mode 100644 index 00000000000..4c1ca1ebde2 Binary files /dev/null and b/src/test/resources/pdfs/IEEE/ieee-paper-cover.pdf differ