-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pdf exporter - delete xmp actions in the menu bar and the cli option (#…
…3947) * Add Xmp GUI Export Adding a new exporter for xmp export in a .xmp file. * updated code with the requested changes * XMP export works now for single elements * Changed the xmp preference distribution, added a split functionality for generating a single .xmp for every bib entry * Added exporter tests for XmpExporter * Writing another exporter for xmp in pdf files to get xmp in production * Delete -xmp cli functionality Deleted the -xmp cli option, because the pdf exporter has now the same functionality and is embedded within the common cli exporter infrastructure. * Rename PdfExporter to XmpPdfExporter * Changed FileType XMP to PDF_XMP * Fixed tests
- Loading branch information
1 parent
68b3797
commit 1d9ce25
Showing
9 changed files
with
47 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/org/jabref/logic/exporter/XmpPdfExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.jabref.logic.exporter; | ||
|
||
import java.nio.charset.Charset; | ||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import org.jabref.logic.util.FileType; | ||
import org.jabref.logic.xmp.XmpPreferences; | ||
import org.jabref.logic.xmp.XmpUtilWriter; | ||
import org.jabref.model.database.BibDatabaseContext; | ||
import org.jabref.model.entry.BibEntry; | ||
|
||
public class XmpPdfExporter extends Exporter { | ||
|
||
private final XmpPreferences xmpPreferences; | ||
|
||
public XmpPdfExporter(XmpPreferences xmpPreferences) { | ||
super("pdf", FileType.PDF_XMP.getDescription(), FileType.PDF_XMP); | ||
this.xmpPreferences = xmpPreferences; | ||
} | ||
|
||
@Override | ||
public void export(BibDatabaseContext databaseContext, Path pdfFile, Charset encoding, List<BibEntry> entries) throws Exception { | ||
|
||
Objects.requireNonNull(databaseContext); | ||
Objects.requireNonNull(pdfFile); | ||
Objects.requireNonNull(entries); | ||
|
||
if (pdfFile.toString().endsWith(".pdf")) { | ||
XmpUtilWriter.writeXmp(pdfFile, entries, databaseContext.getDatabase(), xmpPreferences); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters