PaperBasicInfo
parent
7d0a559a84
commit
868cc95e3f
|
|
@ -389,7 +389,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
|
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
|
||||||
PdfWriter.getInstance(document, out);
|
PdfWriter.getInstance(document, out);
|
||||||
document.open();
|
document.open();
|
||||||
// STSong-Light 为阅读器内置中文字体(cmaps已内置于openpdf jar),无需嵌入字体文件
|
// STSong-Light:openpdf内置中文字体,由阅读器渲染,无需嵌入字体文件
|
||||||
BaseFont baseFont = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
BaseFont baseFont = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
||||||
addPaperPdfHeader(document, baseFont, examInfo.getPaperBasicInfoVO());
|
addPaperPdfHeader(document, baseFont, examInfo.getPaperBasicInfoVO());
|
||||||
if (!CollectionUtils.isEmpty(examInfo.getQuestionVOList())) {
|
if (!CollectionUtils.isEmpty(examInfo.getQuestionVOList())) {
|
||||||
|
|
@ -439,15 +439,18 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperDO> implemen
|
||||||
QuestionTypeEnum typeEnum = QuestionTypeEnum.fromCode(question.getQuestionType());
|
QuestionTypeEnum typeEnum = QuestionTypeEnum.fromCode(question.getQuestionType());
|
||||||
String typeLabel = typeEnum == null ? question.getQuestionType() : typeEnum.getDesc() + "题";
|
String typeLabel = typeEnum == null ? question.getQuestionType() : typeEnum.getDesc() + "题";
|
||||||
String score = question.getScore() == null ? "0" : question.getScore().toPlainString();
|
String score = question.getScore() == null ? "0" : question.getScore().toPlainString();
|
||||||
Paragraph questionLine = new Paragraph("(" + typeLabel + ")" + questionNum + "." + question.getTitle()
|
StringBuilder questionText = new StringBuilder();
|
||||||
+ "(题目分值:" + score + ")", new Font(baseFont, 10, Font.NORMAL));
|
questionText.append("(").append(typeLabel).append(")")
|
||||||
|
.append(questionNum).append(". ").append(question.getTitle())
|
||||||
|
.append("(题目分值:").append(score).append(")");
|
||||||
|
Paragraph questionLine = new Paragraph(questionText.toString(), new Font(baseFont, 10, Font.NORMAL));
|
||||||
questionLine.setSpacingBefore(8f);
|
questionLine.setSpacingBefore(8f);
|
||||||
document.add(questionLine);
|
document.add(questionLine);
|
||||||
if (CollectionUtils.isEmpty(question.getQuestionOptionVOList())) {
|
if (CollectionUtils.isEmpty(question.getQuestionOptionVOList())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (QuestionOptionVO option : question.getQuestionOptionVOList()) {
|
for (QuestionOptionVO option : question.getQuestionOptionVOList()) {
|
||||||
Paragraph optionLine = new Paragraph(option.getOptionKey() + ":" + option.getOptionText(),
|
Paragraph optionLine = new Paragraph(option.getOptionKey() + ": " + option.getOptionText(),
|
||||||
new Font(baseFont, 10, Font.NORMAL));
|
new Font(baseFont, 10, Font.NORMAL));
|
||||||
optionLine.setIndentationLeft(20f);
|
optionLine.setIndentationLeft(20f);
|
||||||
document.add(optionLine);
|
document.add(optionLine);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue