Currently, Springer, and IEEE formats are supported.
In case one wants to have a list of BibEntry matching the bibliography of a PDF,
please see RuleBasedBibliographyPdfImporter.
If several PDF importers should be tried, use PdfMergeMetadataImporter.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private String | |
| private int | |
| private String[] | |
| private String | |
| private static final Pattern |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static Optional | |
| private void | |
| private void | fillCurStringWithNonEmptyLines()
Fill curString with lines until "" is found No trailing space is added i is advanced to the next non-empty line (ignoring white space) Lines containing only white spaces are ignored, but NOT considered as "" Uses GLOBAL variables lines, curLine, i |
| private String | |
| public String | getDescription()
Implements abstract org. Returns the description of the import format. |
| private @Nullable String | |
| pack-priv Optional | getEntryFromPDFContent(String
The raw content of the PDF's first page, which may contain metadata and main content. firstpageContents, String The line separator used to format and unify line breaks in the text content. lineSeparator, Optional<String> An optional title string determined by font size; if provided, this overrides the default title parsing. titleByFontSize)Parses the first page content of a PDF document and extracts bibliographic information such as title, author, abstract, keywords, and other relevant metadata. |
| public String | getId()
Implements abstract org. Returns a slug, which identifies this importer. |
| public String | getName()
Implements abstract org. Returns the name of this import format. |
| public ParserResult | importDatabase(Path filePath, PDDocument document)
Implements abstract org. Note The "throws" clause is for "developer convenience" - it is turned into a ParserResult at |
| private void | proceedToNextNonEmptyLine()
PDFTextStripper normally does NOT produce multiple empty lines (besides at strange PDFs). |
| private void | readLastBlock()
resets curString curString now contains the last block (until "" reached) Trailing space is added invariant before/after: i points to line before the last handled block |
| private String | removeNonLettersAtEnd(String input)
Removes all non-letter characters at the end EXCEPTION: a closing bracket is NOT removed Todo Additionally replace multiple subsequent spaces by one space, which will cause a rename of this method |
| private String | streamlineNames(String names)
Converts an author line as found in a PDF (a "byline") into a BibTeX author list, mapping a trailing |
| private String |
| ARXIV_PREFIX_LENGTH | back to summary |
|---|---|
| private static final int ARXIV_PREFIX_LENGTH | |
| curString | back to summary |
|---|---|
| private String curString | |
| lineIndex | back to summary |
|---|---|
| private int lineIndex | |
| lines | back to summary |
|---|---|
| private String[] lines | |
| year | back to summary |
|---|---|
| private String year | |
| YEAR_EXTRACT_PATTERN | back to summary |
|---|---|
| private static final Pattern YEAR_EXTRACT_PATTERN | |
| PdfContentImporter | back to summary |
|---|---|
| public PdfContentImporter() | |
| extractTitleFromDocument | back to summary |
|---|---|
| private static Optional | |
| extractYear | back to summary |
|---|---|
| private void extractYear() Extract the year out of curString (if it is not yet defined) | |
| fillCurStringWithNonEmptyLines | back to summary |
|---|---|
| private void fillCurStringWithNonEmptyLines() Fill curString with lines until "" is found No trailing space is added i is advanced to the next non-empty line (ignoring white space) Lines containing only white spaces are ignored, but NOT considered as "" Uses GLOBAL variables lines, curLine, i | |
| getArXivId | back to summary |
|---|---|
| private String getArXivId(String arXivId) | |
| getDescription | back to summary |
|---|---|
| public String getDescription() Implements abstract org. Doc from org. Returns the description of the import format. The description should specifywhat kind of entries from what sources and based on what specification it is able to importby what criteria it
| |
| getDoi | back to summary |
|---|---|
| private @Nullable String getDoi(@Nullable String currentDoi) | |
| getEntryFromPDFContent | back to summary |
|---|---|
| pack-priv Optional Parses the first page content of a PDF document and extracts bibliographic information such as title, author, abstract, keywords, and other relevant metadata. This method processes the content line-by-line and uses custom parsing logic to identify and assemble information blocks from academic papers. idea: split[] contains the different lines, blocks are separated by empty lines, treat each block or do special treatment at authors (which are not broken). Therefore, we do a line-based and not a block-based splitting i points to the current line curString (mostly) contains the current block, the different lines are joined into one and thereby separated by " " This method follows the structure typically found in academic paper PDFs:
The parsing logic also identifies and categorizes entries based on keywords such as "Abstract" or "Keywords" and specific terms that denote sections. Additionally, this method can handle publisher-specific formats like Springer or IEEE, extracting data like series, volume, and conference titles.
| |
| getId | back to summary |
|---|---|
| public String getId() Implements abstract org. Doc from org. Returns a slug, which identifies this importer. Used, for example, to identify the importer in CLI. Typically, this name should be short, in English, and should not contain special characters like #, %, etc.
| |
| getName | back to summary |
|---|---|
| public String getName() Implements abstract org. Doc from org. Returns the name of this import format. Typically, this is a string that denotes file type or format. It can also be localized, like "XMP-annotated PDF".
| |
| importDatabase | back to summary |
|---|---|
| public ParserResult importDatabase(Path filePath, PDDocument document) throws IOException Implements abstract org. Doc from org. Note The "throws" clause is for "developer convenience" - it is turned into a ParserResult at
| |
| proceedToNextNonEmptyLine | back to summary |
|---|---|
| private void proceedToNextNonEmptyLine() PDFTextStripper normally does NOT produce multiple empty lines (besides at strange PDFs). These strange PDFs are handled here: proceed to next non-empty line | |
| readLastBlock | back to summary |
|---|---|
| private void readLastBlock() resets curString curString now contains the last block (until "" reached) Trailing space is added invariant before/after: i points to line before the last handled block | |
| removeNonLettersAtEnd | back to summary |
|---|---|
| private String removeNonLettersAtEnd(String input) Removes all non-letter characters at the end EXCEPTION: a closing bracket is NOT removed Todo Additionally replace multiple subsequent spaces by one space, which will cause a rename of this method | |
| streamlineNames | back to summary | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| private String streamlineNames(String names) Converts an author line as found in a PDF (a "byline") into a BibTeX author list, mapping a trailing Neither
Hence the byline is split heuristically here; the result is a plain BibTeX list that
| |||||||||||
| streamlineTitle | back to summary |
|---|---|
| private String streamlineTitle(String title) | |
| Modifier and Type | Class and Description |
|---|---|
| private static record |
| Modifier and Type | Field and Description |
|---|---|
| private final List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | collectCandidates(List<TextPosition> textPositions, int pageIndex, List<PdfContentImporter.
|
| private Optional | |
| public Optional | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | isUnwantedText(TextPosition previousTextPosition, TextPosition textPosition, Map<Float, TextPosition> lastPositionMap, float fontSize)
|
| protected void | writeString(String text, List<TextPosition> textPositions)
Overrides org. Write a Java string to the output stream. |
| textPositionsPerPage | back to summary |
|---|---|
| private final List<List<TextPosition>> textPositionsPerPage | |
| TitleExtractorByFontSize | back to summary |
|---|---|
| public TitleExtractorByFontSize() | |
| collectCandidates | back to summary |
|---|---|
| private void collectCandidates(List<TextPosition> textPositions, int pageIndex, List<PdfContentImporter. | |
| findLargestFontText | back to summary |
|---|---|
| private Optional | |
| getTitle | back to summary |
|---|---|
| public Optional | |
| isFarAway | back to summary |
|---|---|
| private boolean isFarAway(TextPosition previous, TextPosition current) | |
| isLegalTitle | back to summary |
|---|---|
| private boolean isLegalTitle(String candidateText) | |
| isThereSpace | back to summary |
|---|---|
| private boolean isThereSpace(TextPosition previous, TextPosition current) | |
| isUnwantedText | back to summary |
|---|---|
| private boolean isUnwantedText(TextPosition previousTextPosition, TextPosition textPosition, Map<Float, TextPosition> lastPositionMap, float fontSize) | |
| writeString | back to summary |
|---|---|
| protected void writeString(String text, List<TextPosition> textPositions) Overrides org. Doc from org. Write a Java string to the output stream. The default implementation will ignore the
| |
| Modifier and Type | Field and Description |
|---|---|
| private final float | fontSize
Record Component accessed by fontSize(). |
| private final int | pageIndex
Record Component accessed by pageIndex(). |
| private final String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public float | |
| public final int | |
| public int | |
| public String | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| fontSize | back to summary |
|---|---|
| private final float fontSize Record Component accessed by fontSize(). | |
| pageIndex | back to summary |
|---|---|
| private final int pageIndex Record Component accessed by pageIndex(). | |
| text | back to summary |
|---|---|
| private final String text Record Component accessed by text(). | |
| TitleCandidate | back to summary |
|---|---|
| private TitleCandidate(float fontSize, int pageIndex, String text) | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| fontSize | back to summary |
|---|---|
| public float fontSize() Record Component getter of fontSize. | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| pageIndex | back to summary |
|---|---|
| public int pageIndex() Record Component getter of pageIndex. | |
| text | back to summary |
|---|---|
| public String text() Record Component getter of text. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |