本文整理汇总了Java中org.apache.pdfbox.pdmodel.font.PDType1Font.TIMES_BOLD属性的典型用法代码示例。如果您正苦于以下问题:Java PDType1Font.TIMES_BOLD属性的具体用法?Java PDType1Font.TIMES_BOLD怎么用?Java PDType1Font.TIMES_BOLD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.pdfbox.pdmodel.font.PDType1Font
的用法示例。
在下文中一共展示了PDType1Font.TIMES_BOLD属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawSectionHeader
private void drawSectionHeader(String title, float cardXCoordinate, float cardYCoordinate, PDPage page, PDPageContentStream contentStream) throws IOException {
// Set background color
Color color = new Color(73, 89, 105);
float colorBoxWidth = page.getMediaBox().getWidth() - 2 * PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER;
float colorBoxHeight = PdfBoxStyle.DEFAULT_TABLE_ROW_HEIGHT;
PDFont titleFont = PDType1Font.TIMES_BOLD;
float titleFontSize = PdfBoxStyle.TEXT_MEDIUM_SIZE;
Color titleColor = Color.WHITE;
pdfBoxService.addColorBox(color, cardXCoordinate, cardYCoordinate, colorBoxWidth, colorBoxHeight, page, contentStream);
float titleYCoordinate = cardYCoordinate + (colorBoxHeight / 2)
- ((titleFont.getFontDescriptor().getFontBoundingBox().getHeight() / 1000 * titleFontSize) / 4);
pdfBoxService.addTextAtOffset(title, titleFont, titleFontSize, titleColor, cardXCoordinate + 4f, titleYCoordinate, contentStream);
}
示例2: chooseMatchingTimes
/**
* Get a PDType1Font.TIMES-variant, which matches the given font
*
* @param font
* Font to get the styles from
* @return a PDFont Times variant which matches the style in the given Font
* object.
*/
public static PDFont chooseMatchingTimes(Font font) {
if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
return PDType1Font.TIMES_BOLD_ITALIC;
if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
return PDType1Font.TIMES_ITALIC;
if ((font.getStyle() & Font.BOLD) == Font.BOLD)
return PDType1Font.TIMES_BOLD;
return PDType1Font.TIMES_ROMAN;
}
示例3: addConsentTitle
@Override
public void addConsentTitle(String titleMessageKey, float startYCoordinate, PDPage page, PDPageContentStream contentStream) throws IOException {
String consentTitle = getI18nMessage(titleMessageKey);
float titleFontSize = 20f;
PDFont titleFont = PDType1Font.TIMES_BOLD;
Color titleColor = Color.BLACK;
float width = page.getMediaBox().getWidth() - 2 * PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER;
pdfBoxService.addWrappedParagraph(consentTitle, titleFont, titleFontSize, titleColor, TextAlignment.LEFT, PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER, startYCoordinate, width, page, contentStream);
}
示例4: addConsentReferenceNumberAndPatientInfo
@Override
public void addConsentReferenceNumberAndPatientInfo(Consent consent, Patient patient, float startYCoordinate, PDFont defaultFont, PDPageContentStream contentStream) throws IOException {
String consentCreatedOn = PdfBoxHandler.formatDate(consent.getCreatedDateTime(), DATE_FORMAT_PATTERN);
String consentReferenceNumber = consent.getConsentReferenceId();
String patientFullName = patient.getFirstName().concat(SPACE_PATTERN + patient.getLastName());
String patientBirthDate = PdfBoxHandler.formatDate(patient.getBirthDay(), DATE_FORMAT_PATTERN);
final Color textColor = Color.BLACK;
final float fontSize = PdfBoxStyle.TEXT_SMALL_SIZE;
final PDFont contentFont = PDType1Font.TIMES_BOLD;
// Add Consent Created On
final String createdOnLabel = getI18nMessage("REVOCATION.PDF.DATE");
pdfBoxService.addTextAtOffset(createdOnLabel, defaultFont, fontSize, textColor, PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER, startYCoordinate, contentStream);
final float createdOnXCoordinate = PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER + PdfBoxHandler.targetedStringWidth(createdOnLabel, defaultFont, fontSize);
pdfBoxService.addTextAtOffset(consentCreatedOn, contentFont, fontSize, textColor, createdOnXCoordinate, startYCoordinate, contentStream);
// Add Consent Reference Number
final float crnLabelYCoordinate = startYCoordinate - PdfBoxStyle.XLARGE_LINE_SPACE;
final String crnLabel = getI18nMessage("CONSENT.REFERENCE.NUMBER");
pdfBoxService.addTextAtOffset(crnLabel, defaultFont, fontSize, textColor, PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER, crnLabelYCoordinate, contentStream);
final float crnYCoordinate = crnLabelYCoordinate - PdfBoxStyle.XLARGE_LINE_SPACE;
pdfBoxService.addTextAtOffset(consentReferenceNumber, contentFont, fontSize, textColor, PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER, crnYCoordinate, contentStream);
// Add patient name
final float nameYCoordinate = crnYCoordinate - PdfBoxStyle.XLARGE_LINE_SPACE;
final String nameLabel = getI18nMessage("PATIENT.NAME");
pdfBoxService.addTextAtOffset(nameLabel, defaultFont, fontSize, textColor, PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER, nameYCoordinate, contentStream);
final float nameXCoordinate = PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER + PdfBoxHandler.targetedStringWidth(nameLabel, defaultFont, fontSize);
pdfBoxService.addTextAtOffset(patientFullName, contentFont, fontSize, textColor, nameXCoordinate, nameYCoordinate, contentStream);
// Add patient DOB
final String dobLabel = getI18nMessage("PATIENT.DOB");
final float dobLabelXCoordinate = 310f;
pdfBoxService.addTextAtOffset(dobLabel, defaultFont, fontSize, textColor, dobLabelXCoordinate, nameYCoordinate, contentStream);
final float dobXCoordinate = dobLabelXCoordinate + PdfBoxHandler.targetedStringWidth(dobLabel, defaultFont, fontSize);
pdfBoxService.addTextAtOffset(patientBirthDate, contentFont, fontSize, textColor, dobXCoordinate, nameYCoordinate, contentStream);
}
示例5: addConsentSigningDetails
@Override
public void addConsentSigningDetails(Patient patient, Date signedOnDateTime, float startYCoordinate, PDFont defaultFont, PDPageContentStream contentStream) throws IOException {
String patientName = patient.getFirstName().concat(SPACE_PATTERN + patient.getLastName());
String email = patient.getEmail();
final String signedByLabel = getI18nMessage("SIGNED.BY");
final String emailLabel = getI18nMessage("EMAIL");
final String signedOnLabel = getI18nMessage("SIGNED.ON");
final PDFont contentFont = PDType1Font.TIMES_BOLD;
final Color textColor = Color.BLACK;
final float fontSize = PdfBoxStyle.TEXT_SMALL_SIZE;
// Add Signed by
pdfBoxService.addTextAtOffset(signedByLabel, defaultFont, fontSize, textColor, PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER, startYCoordinate, contentStream);
final float crnXCoordinate = PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER + PdfBoxHandler.targetedStringWidth(signedByLabel, defaultFont, fontSize);
pdfBoxService.addTextAtOffset(patientName, contentFont, fontSize, textColor, crnXCoordinate, startYCoordinate, contentStream);
// Add Email
final float emailYCoordinate = startYCoordinate - PdfBoxStyle.XLARGE_LINE_SPACE;
pdfBoxService.addTextAtOffset(emailLabel, defaultFont, fontSize, textColor, PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER, emailYCoordinate, contentStream);
final float nameXCoordinate = PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER + PdfBoxHandler.targetedStringWidth(emailLabel, defaultFont, fontSize);
pdfBoxService.addTextAtOffset(email, contentFont, fontSize, textColor, nameXCoordinate, emailYCoordinate, contentStream);
// Add Signed on
final float signedOnYCoordinate = emailYCoordinate - PdfBoxStyle.XLARGE_LINE_SPACE;
pdfBoxService.addTextAtOffset(signedOnLabel, defaultFont, fontSize, textColor, PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER, signedOnYCoordinate, contentStream);
final float dobXCoordinate = PdfBoxStyle.LEFT_RIGHT_MARGINS_OF_LETTER + PdfBoxHandler.targetedStringWidth(signedOnLabel, defaultFont, fontSize);
pdfBoxService.addTextAtOffset(PdfBoxHandler.formatDate(signedOnDateTime, DATE_FORMAT_PATTERN), contentFont, fontSize, textColor, dobXCoordinate, signedOnYCoordinate, contentStream);
}
示例6: Footer
/**
* Sole constructor.
* Return a footer in gray TIMES_BOLD, sz 8.
* The left part of the text is todays date,
* center is username,
* and the right part is PAGENUM of NUMPAGES
*/
public Footer() {
textColor = Color.gray;
leftText = Footer.DATE;
centerText = Footer.USER;
rightText = "Page " + Footer.PAGENUM + " of " + Footer.NUMPAGES;
OMIT_FIRSTPAGE = true;
COUNT_FIRSTPAGE = true;
font = PDType1Font.TIMES_BOLD;
fontsize = 8;
}
示例7: rText
public float rText(float x, float y, int space, String labelField,
String value, int fieldWidth, int valueWidth)
throws Exception {
PDFont font = PDType1Font.TIMES_BOLD;
content.setFont(font, 9);
float y1 = 0f;
float y2 = 0f;
if (value == null) {
return rText(labelField, fieldWidth, x, y - 19, space, font, false);
} else {
if (labelField == null) {
font = PDType1Font.TIMES_ROMAN;
content.setFont(font, 9);
return rText(value, valueWidth, x, y - 19, space, font, true);
} else {
y1 = rText(labelField, fieldWidth, x, y - 30, space, font,
false);
font = PDType1Font.TIMES_ROMAN;
content.setFont(font, 9);
float y3 = y;
y2 = rText(value, valueWidth, x + fieldWidth + 10, y - 30,
space, font, true);
if (y3 < y2) {
return y2;
} else {
if (y1 >= y2) {
return y2;
} else {
return y1;
}
}
}
}
}
示例8: tryBuiltinFallback
private PDFont tryBuiltinFallback(String fontFamily, boolean isItalic, boolean isBold)
{
PDFont font;
fontFamily = fontFamily.toLowerCase();
switch (fontFamily) {
case "courier":
case "courier new":
case "lucida console":
if (isBold && isItalic) { font = PDType1Font.COURIER_BOLD_OBLIQUE;}
else if (isBold) { font = PDType1Font.COURIER_BOLD;}
else if (isItalic) { font = PDType1Font.COURIER_OBLIQUE;}
else { font = PDType1Font.COURIER;}
break;
case "times":
case "garamond":
case "georgia":
case "times new roman":
case "serif":
if (isBold && isItalic) { font = PDType1Font.TIMES_BOLD_ITALIC;}
else if (isBold) { font = PDType1Font.TIMES_BOLD;}
else if (isItalic) { font = PDType1Font.TIMES_ITALIC;}
else { font = PDType1Font.TIMES_ROMAN;}
break;
default:
if (isBold && isItalic) { font = PDType1Font.HELVETICA_BOLD_OBLIQUE;}
else if (isBold) { font = PDType1Font.HELVETICA_BOLD;}
else if (isItalic) { font = PDType1Font.HELVETICA_OBLIQUE;}
else { font = PDType1Font.HELVETICA;}
break;
}
return font;
}
示例9: drawProviderDetails
private void drawProviderDetails(String providerInfo, float startXCoordinate, float startYCoordinate, float width, PDPage page, PDPageContentStream contentStream) throws IOException {
final PDFont font = PDType1Font.TIMES_BOLD;
final float fontSize = PdfBoxStyle.TEXT_SMALL_SIZE;
final Color textColor = Color.BLACK;
pdfBoxService.addWrappedParagraph(providerInfo, font, fontSize, textColor, TextAlignment.LEFT, startXCoordinate, startYCoordinate, width, page, contentStream);
}