mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-19 07:53:08 +00:00
Add option to select citation page format (LETTER or A4)
This commit is contained in:

committed by
Kim Shepherd

parent
49185db7e9
commit
426d21a1c6
@@ -94,6 +94,11 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
||||
protected String[] fields;
|
||||
protected String footer;
|
||||
|
||||
/**
|
||||
* Citation page format
|
||||
*/
|
||||
protected PDRectangle citationPageFormat = PDRectangle.LETTER;
|
||||
|
||||
@Autowired(required = true)
|
||||
protected AuthorizeService authorizeService;
|
||||
@Autowired(required = true)
|
||||
@@ -195,6 +200,16 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
||||
footer = "Downloaded from DSpace Repository, DSpace Institution's institutional repository";
|
||||
}
|
||||
|
||||
String pageformatCfg = configurationService.getProperty("citation-page.page_format");
|
||||
|
||||
if (pageformatCfg != null) {
|
||||
if (pageformatCfg.equalsIgnoreCase("A4")) {
|
||||
citationPageFormat = PDRectangle.A4;
|
||||
} else if (!pageformatCfg.equalsIgnoreCase("LETTER")) {
|
||||
log.info("Citation-page: Unknown page format ' " + pageformatCfg + "', using LETTER.");
|
||||
}
|
||||
}
|
||||
|
||||
//Ensure a temp directory is available
|
||||
String tempDirString = configurationService.getProperty("dspace.dir") + File.separator + "temp";
|
||||
tempDir = new File(tempDirString);
|
||||
@@ -288,7 +303,7 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
|
||||
try {
|
||||
Item item = (Item) bitstreamService.getParentObject(context, bitstream);
|
||||
sourceDocument = sourceDocument.load(bitstreamService.retrieve(context, bitstream));
|
||||
PDPage coverPage = new PDPage(PDRectangle.LETTER); // TODO: needs to be configurable
|
||||
PDPage coverPage = new PDPage(citationPageFormat);
|
||||
generateCoverPage(context, document, coverPage, item);
|
||||
addCoverPageToDocument(document, sourceDocument, coverPage);
|
||||
|
||||
|
Reference in New Issue
Block a user