List of usage examples for com.itextpdf.text Image getInstance
public static Image getInstance(final Image image)
From source file:com.github.ukase.toolkit.WrappedUserAgentCallback.java
License:Open Source License
@Override public ImageResource getImageResource(String uri) { if (source.hasResource(uri)) { try (InputStream stream = source.getResource(uri)) { Image image = Image.getInstance(StreamUtils.copyToByteArray(stream)); scaleToOutputResolution(image); return new ImageResource(uri, new ITextFSImage(image)); } catch (IOException | DocumentException e) { log.error("Cannot read image [" + uri + "]", e); }//from w ww . j av a 2 s. c om } return delegate.getImageResource(uri); }
From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java
public PdfPTable commodityValues() throws DocumentException, ParseException, Exception { Paragraph p = null;// w w w. j av a 2 s .c om table = new PdfPTable(2); table.setWidthPercentage(100f); table.setWidths(new float[] { 5f, 3.2f }); cell = new PdfPCell(); cell.setBorder(2); cell.setBorderWidthTop(0.6f); cell.setBorderWidthRight(0.6f); cell.setBorderWidthBottom(0f); if (isFirst_page) { cell.addElement(appendChargesAndCommodity()); isFirst_page = false; } else { cell.setFixedHeight(100f); } table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setBorderWidthTop(0.6f); cell.addElement(appendDescComments()); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); PdfPTable fileAndLogo = new PdfPTable(2); fileAndLogo.setWidthPercentage(100f); fileAndLogo.setWidths(new float[] { 4f, 2f }); PdfPCell file = new PdfPCell(); file.setBorder(0); String blNumbering = new LCLBlDAO().getExportBlNumbering(lclbl.getLclFileNumber().getId().toString()); p = new Paragraph(16f, "B/L# " + blNumbering, blackBoldFont14); file.setPaddingTop(-6f); file.addElement(p); fileAndLogo.addCell(file); String companyLogo = LoadLogisoftProperties.getProperty( "ECU".equalsIgnoreCase(ruleName) ? "application.image.logo" : "application.image.econo.logo"); Image img = Image.getInstance(servletPath + companyLogo); img.scalePercent(25); file = new PdfPCell(img); file.setBorder(0); file.setBorder(Rectangle.NO_BORDER); file.setHorizontalAlignment(Element.ALIGN_LEFT); file.setVerticalAlignment(Element.ALIGN_LEFT); file.setBorder(0); fileAndLogo.addCell(file); cell.addElement(fileAndLogo); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java
public PdfPTable companyLogo(String realPath) throws Exception { String path = LoadLogisoftProperties.getProperty("application.image.logo"); table = new PdfPTable(1); table.setWidthPercentage(100f);/*from w w w .j a v a2 s .com*/ Image img = Image.getInstance(realPath + path); img.scalePercent(75); PdfPCell logoCell = new PdfPCell(img); logoCell.setBorder(Rectangle.NO_BORDER); logoCell.setHorizontalAlignment(Element.ALIGN_LEFT); logoCell.setVerticalAlignment(Element.ALIGN_LEFT); logoCell.setBorder(0); logoCell.setPaddingLeft(50); table.addCell(logoCell); return table; }
From source file:com.gp.cong.logisoft.lcl.report.LclVoyageNotificationPdfCreator.java
public PdfPTable onStartPage(String realPath, String scheduleNo, String unitNo, String voyContent) throws Exception { String path = LoadLogisoftProperties.getProperty("application.image.logo"); Font fontArialBold = FontFactory.getFont("Arial", 10f, Font.BOLD); Font colorBoldFont = FontFactory.getFont("Arial", 12f, Font.BOLD, new BaseColor(00, 102, 00)); Phrase p = null;// www .ja va2s .co m Paragraph pValues = null; table = new PdfPTable(6); table.setWidths(new float[] { 0.1f, 1.8f, 2.5f, 3.5f, 1.8f, 1.8f }); table.setWidthPercentage(100f); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setRowspan(3); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(0f); cell.setBorder(0); cell.setPaddingBottom(3f); p = new Phrase("", fontArialBold); p.setLeading(20f); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(25f, "", fontArialBold); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setRowspan(3); cell.setBorder(0); cell.setPadding(0f); Image img = Image.getInstance(realPath + path); img.scalePercent(60); img.setAlignment(Element.ALIGN_CENTER); img.setAlignment(Element.ALIGN_TOP); cell.addElement(img); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(20f, "Date:", fontArialBold); pValues.setAlignment(Element.ALIGN_RIGHT); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(20f, " " + DateUtils.formatStringDateToAppFormatMMM(new Date()), fontArialBold); pValues.setAlignment(Element.ALIGN_LEFT); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(0f); cell.setBorder(0); cell.setPaddingBottom(3f); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPaddingBottom(3f); cell.setPadding(0f); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(9f, "Time:", fontArialBold); pValues.setAlignment(Element.ALIGN_RIGHT); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(9f, " " + DateUtils.formatStringDateToTimeTT(new Date()), fontArialBold); pValues.setAlignment(Element.ALIGN_LEFT); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorder(0); cell.setPaddingBottom(3f); table.addCell(cell); //voyage cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPaddingLeft(5f); pValues = new Paragraph(8f, "VOYAGE NOTIFICATION", colorBoldFont); pValues.setAlignment(Element.ALIGN_CENTER); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.DeliveryOrderPdfCreator.java
public PdfPTable lineTable(FclBl bl, String deliveryDate, String realPath) throws Exception { PdfPCell cell = new PdfPCell(); PdfPCell celL = new PdfPCell(); String path = LoadLogisoftProperties.getProperty("application.image.logo"); String econoPath = LoadLogisoftProperties.getProperty("application.image.econo.logo"); String companyCode = new SystemRulesDAO().getSystemRulesByCode("CompanyCode"); PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100);/* www. j a v a2s.com*/ Paragraph p = null; cell = new PdfPCell(); cell.setColspan(4); cell.setBorder(0); if (null != bl && bl.getBrand().equalsIgnoreCase("Econo") && ("03").equals(companyCode)) { Image img = Image.getInstance(realPath + econoPath); img.setAlignment(Element.ALIGN_CENTER); img.scalePercent(60); img.setAlignment(Element.ALIGN_TOP); cell.addElement(img); } else if (null != bl && bl.getBrand().equalsIgnoreCase("OTI") && ("02").equals(companyCode)) { Image img = Image.getInstance(realPath + econoPath); img.setAlignment(Element.ALIGN_CENTER); img.scalePercent(60); img.setAlignment(Element.ALIGN_TOP); cell.addElement(img); } else if (null != bl && bl.getBrand().equalsIgnoreCase("Ecu Worldwide")) { Image img = Image.getInstance(realPath + path); img.setAlignment(Element.ALIGN_CENTER); img.scalePercent(60); img.setAlignment(Element.ALIGN_TOP); cell.addElement(img); } table.addCell(cell); cell = new PdfPCell(); cell.setColspan(4); cell.setBorder(0); p = new Paragraph("DELIVERY ORDER", blackBoldFontheading); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(4); cell.setBorder(0); p = new Paragraph("DATE PRINTED : " + DateUtils.formatStringDateToAppFormatMMM(new Date()), blackFontForAR); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "CONSIGNEE NAME", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "DATE:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "REF:", blackFontForAR); cell.addElement(p); table.addCell(cell); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(CommonUtils.isNotEmpty(bl.getConsigneeName()) ? bl.getConsigneeName() : ""); stringBuilder.append("\n"); stringBuilder.append(CommonUtils.isNotEmpty(bl.getConsigneeAddress()) ? bl.getConsigneeAddress() : ""); cell = new PdfPCell(); cell.setRowspan(2); cell.setBorderWidthTop(0f); p = new Paragraph(8f, stringBuilder.toString(), blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, deliveryDate, blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, "04-" + bl.getFileNo(), blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); p = new Paragraph(8f, "THE MERCHANDISE DESCRIBED BELOW WILL BE ENTERED AND FORWARDED AS FOLLOWS:", blackFontForAR); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.LclExportVoyageNotificationPdf.java
public PdfPTable imageBlock(String realPath, String path) throws IOException, BadElementException, DocumentException { Font fontArialBold = FontFactory.getFont("Courier", 18f, Font.NORMAL); table = new PdfPTable(1); table.setWidths(new float[] { 5.9f }); table.setWidthPercentage(100f);/*from w w w. j a v a 2 s .c o m*/ cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); Image img = Image.getInstance(realPath + path); img.scalePercent(90); img.setAlignment(Element.ALIGN_CENTER); cell.addElement(img); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); p = new Paragraph(12f, " (866) 326-6648", fontArialBold); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); String companyWebsite = new PropertyDAO().getProperty( companyCode.equalsIgnoreCase("03") ? "application.ECU.website" : "application.OTI.website"); p = new Paragraph(28f, " " + companyWebsite, fontArialBold); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.ideationdesignservices.txtbook.pdf.TxtBookPdf.java
public Boolean createFrontCoverPage(Document document, String coverTitle, Bitmap photo) throws DocumentException, MalformedURLException, IOException { if (photo != null) { int imageMaxWidth; int imageMaxHeight; int imagePosX; int imagePosY; if (photo.getWidth() < photo.getHeight()) { imageMaxWidth = 900;/*from www . ja v a2s . c o m*/ imageMaxHeight = 1200; imagePosX = 198; imagePosY = 379; } else { imageMaxWidth = 1200; imageMaxHeight = 900; imagePosX = 162; imagePosY = 379; } OutputStream stream = new ByteArrayOutputStream(); ImageUtilities.scaleCenterCrop(photo, imageMaxWidth, imageMaxHeight).compress(CompressFormat.JPEG, 50, stream); Image coverImage = Image.getInstance(stream.toByteArray()); coverImage.setAbsolutePosition(0.0f, 0.0f); PdfTemplate t = this.writer.getDirectContent().createTemplate((float) imageMaxWidth, (float) imageMaxHeight); t.newPath(); t.moveTo(0.0f, (float) imageMaxHeight); t.lineTo(0.0f, 71.0f); t.lineTo(17.0f, 71.0f); t.lineTo(17.0f, 0.0f); t.lineTo(72.0f, 71.0f); t.lineTo((float) imageMaxWidth, 71.0f); t.lineTo((float) imageMaxWidth, (float) imageMaxHeight); t.lineTo(0.0f, (float) imageMaxHeight); t.closePath(); t.clip(); t.newPath(); t.addImage(coverImage); t.setColorStroke(new BaseColor(0, 0, 0)); t.setLineWidth(BUBBLE_TEXT_INDENT_ALTERNATE); t.newPath(); t.moveTo(0.0f, (float) imageMaxHeight); t.lineTo(0.0f, 71.0f); t.lineTo(17.0f, 71.0f); t.lineTo(17.0f, 0.0f); t.lineTo(72.0f, 71.0f); t.lineTo((float) imageMaxWidth, 71.0f); t.lineTo((float) imageMaxWidth, (float) imageMaxHeight); t.lineTo(0.0f, (float) imageMaxHeight); t.closePathStroke(); Image clipped = Image.getInstance(t); clipped.scalePercent(24.0f); clipped.setAbsolutePosition((float) imagePosX, (float) imagePosY); clipped.setCompressionLevel(this.settings.compressionLevel); clipped.setAlignment(5); document.add(clipped); } if (coverTitle != null && coverTitle.length() > 0) { PdfContentByte canvas = this.writer.getDirectContent(); Paragraph coverTitleEl = new Paragraph(coverTitle, this.serifFont24); coverTitleEl.setAlignment(1); PdfPTable table = new PdfPTable(1); table.setTotalWidth(311.0f); PdfPCell cell = new PdfPCell(); cell.setBorder(0); cell.addElement(coverTitleEl); cell.setPadding(0.0f); cell.setIndent(0.0f); table.addCell(cell); table.completeRow(); table.writeSelectedRows(0, -1, 147.0f, 390.0f, canvas); } return Boolean.valueOf(true); }
From source file:com.ideationdesignservices.txtbook.pdf.TxtBookPdf.java
public Boolean createBackCoverPage(Document document, String backCoverNote) throws DocumentException, MalformedURLException, IOException { document.newPage();/* w ww.j av a 2s.c o m*/ Image backCoverImageFrame = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/txtbook_backpage_300.png")); backCoverImageFrame.scalePercent(24.0f); backCoverImageFrame.setAbsolutePosition(87.0f, 78.0f); backCoverImageFrame.setCompressionLevel(this.settings.compressionLevel); document.add(backCoverImageFrame); PdfContentByte canvas = this.writer.getDirectContent(); PdfPTable table = new PdfPTable(1); table.setTotalWidth(215.0f); if (backCoverNote != null && backCoverNote.length() > 0) { Paragraph backCoverEl = new Paragraph(backCoverNote, this.serifFont14); PdfPCell cell = new PdfPCell(); cell.setBorder(0); cell.addElement(backCoverEl); cell.setPadding(13.0f); cell.setIndent(0.0f); cell.setFixedHeight(310.0f); table.addCell(cell); table.completeRow(); } Element backUrl = new Anchor("txt-book.com", this.sansFont11Gray); backUrl.setName("txt-book.com"); backUrl.setReference("http://www.txt-book.com"); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(2); paragraph.add(backUrl); PdfPCell cell2 = new PdfPCell(); cell2.setBorder(0); cell2.setHorizontalAlignment(2); cell2.addElement(paragraph); cell2.setPadding(0.0f); cell2.setPaddingTop(0.0f); cell2.setIndent(0.0f); table.addCell(cell2); table.completeRow(); table.writeSelectedRows(0, -1, 306.0f, 400.0f, canvas); return Boolean.valueOf(true); }
From source file:com.ideationdesignservices.txtbook.pdf.TxtBookPdf.java
public float addConversationPart(ColumnText ct, int column, String dateString, String senderString, String contentString, Bitmap contentBitmap, Boolean isVideo, Boolean isMe) throws DocumentException, MalformedURLException, IOException { float messageWidth = 196.0f; Chunk dateChunk = new Chunk(new StringBuilder(String.valueOf(dateString)) .append(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR).toString(), this.sansFont6Gray); float dateWidth = dateChunk.getWidthPoint(); Paragraph contentParagraph = new Paragraph(); if (contentString.length() > 0) { Element contentChunk = new Chunk(contentString, this.sansFont9); messageWidth = contentChunk.getWidthPoint(); contentParagraph.add(contentChunk); }//from www . j a v a2s. co m if (messageWidth < dateWidth) { messageWidth = dateWidth; } if (messageWidth > MAX_COLUMN_CONTENT_WIDTH) { messageWidth = MAX_COLUMN_CONTENT_WIDTH; dateWidth += 7.0f; } Paragraph dateParagraph = new Paragraph(dateChunk); if (isMe.booleanValue()) { dateParagraph.setAlignment(0); dateParagraph .setIndentationLeft((((BUBBLE_L_WIDTH + messageWidth) + BUBBLE_R_WIDTH) + 7.0f) - dateWidth); } else { dateParagraph.setAlignment(2); dateParagraph .setIndentationRight((((BUBBLE_L_WIDTH + messageWidth) + BUBBLE_R_WIDTH) + 7.0f) - dateWidth); } ct.addElement(dateParagraph); contentParagraph.setExtraParagraphSpace(10.0f); if (contentString.length() > 0) { contentParagraph.setAlignment(0); if (isMe.booleanValue()) { contentParagraph.setIndentationLeft(8.6f); contentParagraph.setIndentationRight(BUBBLE_TEXT_INDENT_ALTERNATE); } else { contentParagraph.setIndentationRight(8.6f); float indentLeft = COLUMN_WIDTH - (BUBBLE_L_WIDTH + messageWidth); if (messageWidth == MAX_COLUMN_CONTENT_WIDTH) { indentLeft += BUBBLE_TEXT_INDENT_ALTERNATE; } contentParagraph.setIndentationLeft(indentLeft); } ct.addElement(contentParagraph); } else if (contentBitmap != null) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); if (isVideo.booleanValue()) { contentBitmap.compress(CompressFormat.PNG, 50, stream); } else { contentBitmap.compress(CompressFormat.JPEG, 50, stream); } Image contentImage = Image.getInstance(stream.toByteArray()); contentImage.scaleToFit(198.0f, 198.0f); if (isVideo.booleanValue()) { contentImage.setCompressionLevel(this.settings.compressionLevel); } contentImage.setSpacingBefore(10.0f); contentImage.setSpacingAfter(10.0f); if (isMe.booleanValue()) { contentImage.setAlignment(1); } else { contentImage.setAlignment(1); } ct.addElement(contentImage); } Paragraph senderParagraph = new Paragraph(new Chunk(senderString, this.sansFont9Gray)); if (!isMe.booleanValue()) { senderParagraph.setAlignment(2); } senderParagraph.setSpacingAfter(BUBBLE_TEXT_INDENT_ALTERNATE); ct.addElement(senderParagraph); return messageWidth; }
From source file:com.ideationdesignservices.txtbook.pdf.TxtBookPdf.java
public void addConversationBackground(Document document, ColumnText ct, int column, float top, float messageWidth, float messageHeight, Boolean isMe) throws DocumentException, MalformedURLException, IOException { float[][] COLUMNS; if (messageWidth < MAX_COLUMN_CONTENT_WIDTH) { messageWidth += 8.0f;/*from w w w. j a v a 2 s .co m*/ } messageHeight -= 35.0f; top -= BaseField.BORDER_WIDTH_THICK; if (COLUMNS_REG[0][0] == Txtbook.leftMargin(this.writer, document, this.settings.addFrontCover)) { COLUMNS = COLUMNS_REG; } else { COLUMNS = COLUMNS_ALT; } float left = COLUMNS[column][0]; PdfContentByte under = this.writer.getDirectContentUnder(); PdfTemplate bg = this.writer.getDirectContentUnder().createTemplate( (BUBBLE_L_WIDTH + messageWidth) + BUBBLE_R_WIDTH, (BUBBLE_T_HEIGHT + messageHeight) + BUBBLE_L_WIDTH); String num = isMe.booleanValue() ? "1" : "2"; Image bgTL = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/bubble_" + num + "_tl.png")); bgTL.scaleAbsoluteWidth(BUBBLE_L_WIDTH); bgTL.scaleAbsoluteHeight(BUBBLE_T_HEIGHT); bgTL.setAbsolutePosition(0.0f, BUBBLE_L_WIDTH + messageHeight); bg.addImage(bgTL); Image bgT = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/bubble_" + num + "_t.png")); bgT.scaleAbsoluteWidth(messageWidth); bgT.scaleAbsoluteHeight(BUBBLE_T_HEIGHT); bgT.setAbsolutePosition(BUBBLE_L_WIDTH, BUBBLE_L_WIDTH + messageHeight); bg.addImage(bgT); Image bgTR = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/bubble_" + num + "_tr.png")); bgTR.scaleAbsoluteWidth(BUBBLE_R_WIDTH); bgTR.scaleAbsoluteHeight(BUBBLE_T_HEIGHT); bgTR.setAbsolutePosition(BUBBLE_L_WIDTH + messageWidth, BUBBLE_L_WIDTH + messageHeight); bg.addImage(bgTR); Image bgL = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/bubble_" + num + "_l.png")); bgL.scaleAbsoluteWidth(BUBBLE_L_WIDTH); bgL.scaleAbsoluteHeight(messageHeight); bgL.setAbsolutePosition(0.0f, BUBBLE_L_WIDTH); bg.addImage(bgL); bg.saveState(); if (isMe.booleanValue()) { bg.setRGBColorFill(241, 241, 241); } else { bg.setRGBColorFill(208, 231, 196); } bg.rectangle(BUBBLE_L_WIDTH, BUBBLE_L_WIDTH, messageWidth, messageHeight); bg.fill(); bg.restoreState(); Image bgR = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/bubble_" + num + "_r.png")); bgR.scaleAbsoluteWidth(BUBBLE_R_WIDTH); bgR.scaleAbsoluteHeight(messageHeight); bgR.setAbsolutePosition(BUBBLE_L_WIDTH + messageWidth, BUBBLE_L_WIDTH); bg.addImage(bgR); Image bgBL = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/bubble_" + num + "_bl.png")); bgBL.scaleAbsoluteWidth(BUBBLE_L_WIDTH); bgBL.scaleAbsoluteHeight(BUBBLE_L_WIDTH); bgBL.setAbsolutePosition(0.0f, 0.0f); bg.addImage(bgBL); Image bgB = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/bubble_" + num + "_b.png")); bgB.scaleAbsoluteWidth(messageWidth); bgB.scaleAbsoluteHeight(BUBBLE_L_WIDTH); bgB.setAbsolutePosition(BUBBLE_L_WIDTH, 0.0f); bg.addImage(bgB); Image bgBR = Image .getInstance(ImageUtilities.getImageDataForFile(this.mContext, "pdf/bubble_" + num + "_br.png")); bgBR.scaleAbsoluteWidth(BUBBLE_R_WIDTH); bgBR.scaleAbsoluteHeight(BUBBLE_L_WIDTH); bgBR.setAbsolutePosition(BUBBLE_L_WIDTH + messageWidth, 0.0f); bg.addImage(bgBR); if (!isMe.booleanValue()) { bg.setMatrix(BUBBLE_TEXT_INDENT_MAIN, 0.0f, 0.0f, BaseField.BORDER_WIDTH_THIN, 0.0f, 0.0f); left += COLUMN_WIDTH; } under.addTemplate(bg, left, (top - messageHeight) - 20.0f); }