PaperBasicInfo

dev-tmp1
luotaiqian 2026-08-20 11:42:36 +08:00
parent 7d0a559a84
commit 868cc95e3f
1 changed files with 7 additions and 4 deletions

View File

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