List of usage examples for com.itextpdf.text Image getInstance
public static Image getInstance(final Image image)
From source file:Controller.Movimientos.generatePDF.java
public void generateAgendaClientes() { mm = new Model_Movimientos(); try {/*from ww w. ja v a 2 s .c o m*/ Calendar calendar = Calendar.getInstance(); int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); int monthOfYear = calendar.get(Calendar.MONTH); int year = calendar.get(Calendar.YEAR); int hour = calendar.get(Calendar.HOUR_OF_DAY); int min = calendar.get(Calendar.MINUTE); int sec = calendar.get(Calendar.SECOND); Document documento = new Document();//Creamos el documento FileOutputStream ficheroPdf = new FileOutputStream("agendaClientes" + dayOfMonth + "--" + monthOfYear + "--" + year + " " + hour + ";" + min + ";" + sec + ".pdf");//Abrimos el flujo y le asignamos nombre al pdf y su direccion PdfWriter.getInstance(documento, ficheroPdf).setInitialLeading(20);//Instanciamos el documento con el fichero documento.open();//Abrimos el documento documento.add(new Paragraph("Agenda Clientes", FontFactory.getFont("Calibri", 30, Font.BOLD, BaseColor.BLACK)));//Le indicamos el tipo de letra, el tamanio, el estilo y el color de la letra documento.add(new Paragraph("___________________________"));//Realiza un salto de linea Iterator it; it = mm.getUserss().iterator(); while (it.hasNext()) { User u = (User) it.next(); System.out.println("" + u.getEmail().toString()); documento.add(new Paragraph("")); try { Image foto = Image.getInstance("src/IMG/userBig.png"); foto.scaleToFit(48, 48); foto.setAlignment(Chunk.ALIGN_LEFT); documento.add(foto); } catch (Exception e) { e.printStackTrace(); } //Le decimos que nos imprima el Dni, Nombre y Apellidos del cliente, contenidos en el objeto Cliente y le indicamos el tipo de letra, tamanio, estilo y color de la letra documento.add(new Paragraph( "Nombre: " + u.getName() + " Apellidos: " + u.getSurname() + " Email: " + u.getEmail() + " Nickname: " + u.getNickname() + " Contrasea: " + u.getPassword(), FontFactory.getFont("Calibri", 8, Font.BOLD, BaseColor.BLACK))); documento.add(new Paragraph(" ")); documento.add(new Paragraph( "______________________________________________________________________________")); } documento.close();//Cerramos el flujo con el documento JOptionPane.showMessageDialog(null, "Se ha creado la agenda Clientes."); } catch (DocumentException ex) { Logger.getLogger(generatePDF.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(generatePDF.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:controller.PlanController.java
public Document PrintPressed(String Path) throws DocumentException, IOException { // step 1//from w w w .j av a2 s . c om Document document = new Document(); // step 2 PdfWriter.getInstance(document, new FileOutputStream(Path)); // step 3 document.open(); // step 4 PdfPTable tablaDatosPlan = new PdfPTable(2); tablaDatosPlan.setWidthPercentage(100); if (!Team.getText().isEmpty()) { PdfPCell cell1 = new PdfPCell(new Phrase(messages.getString("Team") + ":" + Team.getText())); cell1.setBorderColor(BaseColor.WHITE); tablaDatosPlan.addCell(cell1); } if (!Season.getText().isEmpty()) { PdfPCell cell1 = new PdfPCell(new Phrase(messages.getString("Season") + ":" + Season.getText())); cell1.setBorderColor(BaseColor.WHITE); tablaDatosPlan.addCell(cell1); } if (!Date.getText().isEmpty()) { PdfPCell cell1 = new PdfPCell(new Phrase(messages.getString("Date") + ":" + Date.getText())); cell1.setBorderColor(BaseColor.WHITE); tablaDatosPlan.addCell(cell1); } if (!Players.getText().isEmpty()) { PdfPCell cell1 = new PdfPCell(new Phrase(messages.getString("Players") + ":" + Players.getText())); cell1.setBorderColor(BaseColor.WHITE); tablaDatosPlan.addCell(cell1); } if (!Start.getText().isEmpty()) { PdfPCell cell1 = new PdfPCell(new Phrase(messages.getString("Start") + ":" + Start.getText())); cell1.setBorderColor(BaseColor.WHITE); tablaDatosPlan.addCell(cell1); } if (!End.getText().isEmpty()) { PdfPCell cell1 = new PdfPCell(new Phrase(messages.getString("End") + ":" + End.getText())); cell1.setBorderColor(BaseColor.WHITE); tablaDatosPlan.addCell(cell1); } if (!Place.getText().isEmpty()) { PdfPCell cell1 = new PdfPCell(new Phrase(messages.getString("Place") + ":" + Place.getText())); cell1.setBorderColor(BaseColor.WHITE); tablaDatosPlan.addCell(cell1); } if (!Equipment.getText().isEmpty()) { PdfPCell cell1 = new PdfPCell(new Phrase(messages.getString("Equipment") + ":" + Equipment.getText())); cell1.setBorderColor(BaseColor.WHITE); tablaDatosPlan.addCell(cell1); } document.add(tablaDatosPlan); document.add(new Phrase("\n")); document.add(new Phrase("\n")); PdfPTable tablaEjercicios = new PdfPTable(4); tablaEjercicios.setHeaderRows(contadorlineas); tablaEjercicios.addCell(messages.getString("Start")); tablaEjercicios.addCell(messages.getString("End")); tablaEjercicios.addCell(messages.getString("Drill")); tablaEjercicios.addCell(messages.getString("Notes")); int cont = 0; for (int aw = 4; aw < contadorlineas + 4; aw++) { tablaEjercicios.addCell(starColumn.getCellData(cont)); tablaEjercicios.addCell(endColumn.getCellData(cont)); tablaEjercicios.addCell(drillColumn.getCellData(cont)); tablaEjercicios.addCell(notesColumn.getCellData(cont)); cont++; } document.add(tablaEjercicios); int contadorListado = 0, contadorRecorrer = 0; if (checkboxDrills.isSelected()) { while (contadorListado < planData.size()) { contadorRecorrer = 0; while (contadorRecorrer < playData.size()) { System.out.println("Busco el ejercicio " + drillColumn.getCellData(contadorListado)); if (drillColumn.getCellData(contadorListado) .contains(playData.get(contadorRecorrer).getNombreJugada())) { int contador = 1; System.out.println("Ejercicio encontrado"); document.add(new Paragraph( messages.getString("Drill") + " " + drillColumn.getCellData(contadorListado))); while (contador < playData.get(contadorRecorrer).getContadorJugada() + 1) { document.add(new Paragraph(messages.getString("Diagram") + " " + contador)); document.add(new Paragraph(" ")); Image image2 = Image.getInstance(playData.get(contadorRecorrer).getNombreJugada() + "-" + playData.get(contadorRecorrer).getTipoJugada() + "-" + playData.get(contadorRecorrer).getSubtipoJugada() + "_" + contador); image2.scalePercent(50); PdfPTable table1 = new PdfPTable(2); table1.addCell(image2); table1.addCell( textPdf.textPdf(contador, playData.get(contadorRecorrer).getDescripcionJugada(), playData.get(contadorRecorrer).getContadorJugada())); document.add(table1); contador++; } } contadorRecorrer++; } contadorListado++; } } // step 5 document.close(); return document; }
From source file:cz.muni.pdfjbim.PdfImageExtractor.java
License:Apache License
private List<Image> getImagesFromPdfDict(PdfDictionary dict, PdfReader doc) throws IOException { List<Image> images = new ArrayList<Image>(); PdfDictionary res = (PdfDictionary) (PdfReader.getPdfObject(dict.get(PdfName.RESOURCES))); PdfDictionary xobj = (PdfDictionary) (PdfReader.getPdfObject(res.get(PdfName.XOBJECT))); if (xobj != null) { for (PdfName name : xobj.getKeys()) { PdfObject obj = xobj.get(name); if (obj.isIndirect()) { PdfDictionary tg = (PdfDictionary) (PdfReader.getPdfObject(obj)); PdfName subtype = (PdfName) (PdfReader.getPdfObject(tg.get(PdfName.SUBTYPE))); if (PdfName.IMAGE.equals(subtype)) { int xrefIdx = ((PRIndirectReference) obj).getNumber(); PdfObject pdfObj = doc.getPdfObject(xrefIdx); PdfStream str = (PdfStream) (pdfObj); byte[] bytes = PdfReader.getStreamBytesRaw((PRStream) str); String filter = tg.get(PdfName.FILTER).toString(); String width = tg.get(PdfName.WIDTH).toString(); String height = tg.get(PdfName.HEIGHT).toString(); String bpp = tg.get(PdfName.BITSPERCOMPONENT).toString(); if ("/FlateDecode".equals(filter)) { bytes = PdfReader.FlateDecode(bytes, true); try { images.add(Image.getInstance(bytes)); } catch (BadElementException ex) { log.warn("problem to process FlatDecoded Image", ex); }//from w w w. j a va 2 s . c o m } else if (PdfName.FORM.equals(subtype) || PdfName.GROUP.equals(subtype)) { images.addAll(getImagesFromPdfDict(tg, doc)); } } } } } return images; }
From source file:cz.zcu.kiv.eegdatabase.logic.pdf.PDFUtils.java
License:Apache License
private Image GetResizedAndCenteredImage(String filename) throws IOException, BadElementException { Image img = Image.getInstance(filename); if (img.getWidth() <= PageSize.A4.getWidth() - PADDING[1] - PADDING[3]) { return img; }/* w w w . j a va2 s .c o m*/ float newWidth = PageSize.A4.getWidth() - PADDING[1] - PADDING[3]; float ratio = newWidth / img.getWidth(); float newHeight = img.getHeight() * ratio; img.scaleAbsolute(newWidth, newHeight); return img; }
From source file:dbms_prj.Display.java
public void create_pdf() throws Exception { Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream(S1 + ".pdf")); Image image = Image.getInstance("src/Travel partners.png"); image.scaleAbsolute(500f, 200f);//from w w w. j av a 2 s .com Image ima = Image.getInstance("src/images.jpg"); ima.scaleAbsolute(100f, 100f); ima.setAlignment(Element.ALIGN_CENTER); PdfPTable table = new PdfPTable(9); PdfPCell cell = new PdfPCell(new Paragraph("Ticket")); cell.setColspan(9); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPadding(10.0f); cell.setBackgroundColor(new BaseColor(140, 221, 8)); table.addCell(cell); table.addCell("PNR"); table.addCell("BOOK_ID"); table.addCell("FLIGHT_NO"); table.addCell("NAME"); table.addCell("SOURCE"); table.addCell("DESTINATION"); table.addCell("STATUS"); table.addCell("FARE"); table.addCell("Date"); table.addCell(S1); table.addCell(S11); table.addCell(S4); table.addCell(S6 + " " + S7); table.addCell(S8); table.addCell(S9); table.addCell(S5); table.addCell(S10); table.addCell(S12); table.setSpacingBefore(30.0f); // Space Before table starts, like margin-top in CSS table.setSpacingAfter(30.0f); doc.open(); //doc.add(new Paragraph("Hello!! Yo this is my first pdf!")); doc.add(image); doc.add(new Paragraph("Ticket created on " + new Date().toString())); doc.add(table); //doc.add(list); doc.add(ima); doc.close(); }
From source file:dbms_prj.Status.java
public void create_pdf() throws Exception { Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream(S1 + ".pdf")); Image image = Image.getInstance("src/Travel partners.png"); image.scaleAbsolute(500f, 200f);//from www . j a v a 2 s.com Image ima = Image.getInstance("src/images.jpg"); ima.scaleAbsolute(100f, 100f); ima.setAlignment(Element.ALIGN_CENTER); PdfPTable table = new PdfPTable(9); PdfPCell cell = new PdfPCell(new Paragraph("Ticket")); cell.setColspan(9); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPadding(10.0f); table.setTotalWidth(300.0f); cell.setBackgroundColor(new BaseColor(140, 221, 8)); table.addCell(cell); table.addCell("PNR"); table.addCell("BOOK_ID"); table.addCell("FLIGHT_NO"); table.addCell("NAME"); table.addCell("SOURCE"); table.addCell("DESTINATION"); table.addCell("STATUS"); table.addCell("FARE"); table.addCell("Date"); table.addCell(S1); table.addCell(S11); table.addCell(S4); table.addCell(S6 + S7); table.addCell(S8); table.addCell(S9); table.addCell(S5); table.addCell(S10); table.addCell(S2); table.setSpacingBefore(50.0f); // Space Before table starts, like margin-top in CSS table.setSpacingAfter(50.0f); doc.open(); //doc.add(new Paragraph("Hello!! Yo this is my first pdf!")); doc.add(image); //doc.add(new Paragraph("Ticket created on " + new Date().toString())); doc.add(table); //doc.add(list); doc.add(ima); doc.close(); }
From source file:de.aidger.utils.pdf.ActivityReportConverter.java
License:Open Source License
/** * Writes the logos and the address of the institute. *///from w w w. j a v a 2s . c o m private void writeLogo() { try { Font generatedByFont = new Font( BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 8); Image aidger = Image.getInstance(getClass().getResource("/de/aidger/res/pdf/AidgerLogo.png")); aidger.scaleAbsolute(80.0f, 20.0f); PdfPTable table = new PdfPTable(2); table.setTotalWidth(reader.getPageSize(1).getRight()); PdfPCell cell = new PdfPCell(new Phrase(_("Generated by: "), generatedByFont)); cell.setBorder(0); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); cell = new PdfPCell(Image.getInstance(aidger)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(0); table.addCell(cell); table.writeSelectedRows(0, -1, 0, 25, contentByte); } catch (BadElementException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:de.alpharogroup.swing.img.ImageExtensions.java
License:Open Source License
/** * Creates from the given Collection of images an pdf file. * * @param result// w w w. j a v a 2 s. co m * the output stream from the pdf file where the images shell be written. * @param images * the BufferedImage collection to be written in the pdf file. * @throws DocumentException * is thrown if an error occurs when trying to get an instance of {@link PdfWriter}. * @throws IOException * Signals that an I/O exception has occurred. */ public static void createPdf(final OutputStream result, final List<BufferedImage> images) throws DocumentException, IOException { final Document document = new Document(); PdfWriter.getInstance(document, result); for (final BufferedImage image : images) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "png", baos); final Image img = Image.getInstance(baos.toByteArray()); document.setPageSize(img); document.newPage(); img.setAbsolutePosition(0, 0); document.add(img); } document.close(); }
From source file:de.domjos.schooltools.core.utils.fileUtils.PDFBuilder.java
License:Open Source License
public void onEndPage(PdfWriter writer, Document document) { try {/*from w w w .ja v a 2s. c o m*/ Rectangle rect = writer.getBoxSize("art"); Image img = Image.getInstance(Converter.convertDrawableToByteArray(this.context, R.drawable.icon)); Phrase phrase = new Phrase(); phrase.add(new Chunk(img, 0, 0)); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, phrase, rect.getLeft(), rect.getBottom(), 0); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(String .valueOf(this.context.getString(R.string.api_page) + " " + document.getPageNumber())), rect.getRight(), rect.getBottom(), 0); } catch (Exception ex) { Helper.printException(context, ex); } }
From source file:de.earthdawn.ECEPdfExporter.java
License:Open Source License
public void exportRedbrickExtended(EDCHARACTER edCharakter, File outFile) throws DocumentException, IOException { PdfReader reader = new PdfReader( new FileInputStream(new File("./templates/ed3_extended_character_sheet.pdf"))); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(outFile)); acroFields = stamper.getAcroFields(); CharacterContainer character = new CharacterContainer(edCharakter); // +++ DEBUG +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //Set<String> fieldNames = acroFields.getFields().keySet(); //fieldNames = new TreeSet<String>(fieldNames); //for( String fieldName : fieldNames ) { // acroFields.setField( fieldName, fieldName ); // System.out.println( fieldName ); //}//from w w w .j a v a 2s. com // +++ ~DEBUG ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ exportCommonFields(character, 16, 55); setButtons(character.getWound().getNormal(), "WoundPenalties.", 9); acroFields.setField("Shield", "none"); acroFields.setField("ShieldDeflectionBonus", "na"); // Charakter Potrait-Bild einfgen List<Base64BinaryType> potraits = character.getPortrait(); if (!potraits.isEmpty()) { Image image = Image.getInstance(potraits.get(0).getValue()); image.setAbsolutePosition(35f, 517f); image.scaleAbsolute(165f, 200f); PdfContentByte overContent = stamper.getOverContent(2); overContent.addImage(image); } int armor_max = 0; int shield_max = 0; for (ARMORType armor : character.getProtection().getARMOROrSHIELD()) { if (!armor.getUsed().equals(YesnoType.YES)) continue; if (armor.getClass().getSimpleName().equals("ARMORType")) { if (armor.getPhysicalarmor() > armor_max) { armor_max = armor.getPhysicalarmor(); acroFields.setField("Armor", armor.getName()); } } else if (armor.getClass().getSimpleName().equals("SHIELDType")) { SHIELDType shield = (SHIELDType) armor; if (shield.getPhysicalarmor() > shield_max) { shield_max = armor.getPhysicalarmor(); acroFields.setField("Shield", shield.getName()); acroFields.setField("ShieldDeflectionBonus", shield.getPhysicaldeflectionbonus() + "/" + shield.getMysticdeflectionbonus()); } } else { System.err.println("Unbekannte Rstungstyp: " + armor.getClass().getSimpleName()); } } acroFields.setField("Discipline", concat(" / ", character.getDisciplineNames())); acroFields.setField("Circle", concat(" / ", character.getDisciplineCircles())); int counterKarmaritual = 0; for (String karmaritual : character.getAllKarmaritual()) { for (String description : wrapString(50, karmaritual)) { if (counterKarmaritual > 11) { System.err.println("Karmaritual description is to long. Only first 12 lines were displayed."); break; } acroFields.setField("KarmaRitual." + counterKarmaritual, description); counterKarmaritual++; } } List<DISCIPLINEType> disciplines = character.getDisciplines(); if (!disciplines.isEmpty()) { DISCIPLINEType discipline1 = disciplines.get(0); int counter = 0; List<TALENTType> disziplinetalents = discipline1.getDISZIPLINETALENT(); Collections.sort(disziplinetalents, new TalentComparator()); HashMap<String, ATTRIBUTEType> attributes = character.getAttributes(); for (TALENTType talent : disziplinetalents) { if ((talent.getCircle() > 4) && (counter < 9)) counter = 9; if ((talent.getCircle() > 8) && (counter < 13)) counter = 13; if ((talent.getCircle() > 12) && (counter < 17)) counter = 17; setTalent(counter, talent, attributes); counter++; } List<TALENTType> optionaltalents = discipline1.getOPTIONALTALENT(); Collections.sort(optionaltalents, new TalentComparator()); counter = 0; for (TALENTType talent : optionaltalents) { if ((talent.getCircle() > 4) && (counter < 7)) counter = 7; if ((talent.getCircle() > 8) && (counter < 13)) counter = 13; setTalent(20 + counter, talent, attributes); // Optionale Talente knnen Karma erfordern if (talent.getKarma().equals(YesnoType.YES)) { acroFields.setField("KarmaRequired." + counter, "Yes"); } else { acroFields.setField("KarmaRequired." + counter, ""); } counter++; } } if (disciplines.size() > 1) { DISCIPLINEType discipline2 = disciplines.get(1); int counter = 36; List<TALENTType> disziplinetalents = discipline2.getDISZIPLINETALENT(); Collections.sort(disziplinetalents, new TalentComparator()); HashMap<String, ATTRIBUTEType> attributes = character.getAttributes(); for (TALENTType talent : disziplinetalents) { if ((talent.getCircle() > 4) && (counter < 44)) counter = 44; if ((talent.getCircle() > 8) && (counter < 48)) counter = 48; if ((talent.getCircle() > 12) && (counter < 52)) counter = 52; setTalent(counter, talent, attributes); counter++; } List<TALENTType> optionaltalents = discipline2.getOPTIONALTALENT(); Collections.sort(optionaltalents, new TalentComparator()); counter = 16; for (TALENTType talent : optionaltalents) { if ((talent.getCircle() > 4) && (counter < 22)) counter = 22; if ((talent.getCircle() > 8) && (counter < 26)) counter = 26; setTalent(39 + counter, talent, attributes); // Optionale Talente knnen Karma erfordern if (talent.getKarma().equals(YesnoType.YES)) { acroFields.setField("KarmaRequired." + counter, "Yes"); } else { acroFields.setField("KarmaRequired." + counter, ""); } counter++; } } List<WEAPONType> weapons = character.getWeapons(); if (weapons != null) { int counter_melee = 0; int counter_range = 0; for (WEAPONType weapon : weapons) { if (weapon.getShortrange() > 0) { acroFields.setField("RangedWeapon." + counter_range, weapon.getName()); acroFields.setField("RangedWeaponDmgStep." + counter_range, String.valueOf(weapon.getDamagestep())); acroFields.setField("RangedWeapon Size." + counter_range, String.valueOf(weapon.getSize())); acroFields.setField("RangedWeaponTimesForged." + counter_range, String.valueOf(weapon.getTimesforged())); acroFields.setField("WeaponShortRange." + counter_range, String.valueOf(weapon.getShortrange())); acroFields.setField("Weapon Long Range." + counter_range, String.valueOf(weapon.getLongrange())); counter_range++; } else { acroFields.setField("Weapon." + counter_melee, weapon.getName()); acroFields.setField("WeaponDmgStep." + counter_melee, String.valueOf(weapon.getDamagestep())); acroFields.setField("Weapon Size." + counter_melee, String.valueOf(weapon.getSize())); acroFields.setField("WeaponTimesForged." + counter_melee, String.valueOf(weapon.getTimesforged())); counter_melee++; } } } List<List<SPELLType>> spellslist = new ArrayList<List<SPELLType>>(); spellslist.add(character.getOpenSpellList()); for (DISCIPLINEType discipline : disciplines) spellslist.add(discipline.getSPELL()); setSpellRedbrick(spellslist); counterEquipment = 0; for (ITEMType item : listArmorAndWeapon(character)) addEquipment(item.getName(), item.getWeight()); for (ITEMType item : character.getItems()) addEquipment(item.getName(), item.getWeight()); for (MAGICITEMType item : character.getMagicItem()) { StringBuffer text = new StringBuffer(item.getName()); text.append(" ("); text.append(item.getBlooddamage()); text.append("/"); text.append(item.getDepatterningrate()); text.append("/"); text.append(item.getEnchantingdifficultynumber()); text.append(")"); addEquipment(text.toString(), item.getWeight()); } int copperPieces = 0; int goldPieces = 0; int silverPieces = 0; for (COINSType coins : character.getAllCoins()) { addEquipment(coinsToString(coins), coins.getWeight()); copperPieces += coins.getCopper(); silverPieces += coins.getSilver(); goldPieces += coins.getGold(); } acroFields.setField("CopperPieces", String.valueOf(copperPieces)); acroFields.setField("SilverPieces", String.valueOf(silverPieces)); acroFields.setField("GoldPieces", String.valueOf(goldPieces)); int counterDescription = 0; for (String description : wrapString(60, character.getDESCRIPTION())) { acroFields.setField("ShortDescription." + counterDescription, description); counterDescription++; if (counterDescription > 7) { System.err.println("Character description to long. Only first 8 lines were displayed."); break; } } int counterMagicItem = 0; int counterThreadItem = 0; for (THREADITEMType item : character.getThreadItem()) { int weaventhreadrank = item.getWeaventhreadrank(); acroFields.setField("MagicalTreasureName." + counterMagicItem, item.getName()); acroFields.setField("MagicalTreasureSpellDefense." + counterMagicItem, String.valueOf(item.getSpelldefense())); acroFields.setField("MagicalTreasureMaxThreads." + counterMagicItem, String.valueOf(item.getMaxthreads())); int counterMagicItemDescription = 0; for (String description : wrapString(55, item.getDESCRIPTION())) { acroFields.setField("MagicalTreasureDesc." + counterMagicItemDescription + "." + counterMagicItem, description); counterMagicItemDescription++; if (counterMagicItemDescription > 2) { System.err.println("MagicItem description to long. Only first 3 lines were displayed."); break; } } int counterMagicItemRank = 0; for (THREADRANKType rank : item.getTHREADRANK()) { acroFields.setField("MagicalTreasureRank." + counterMagicItemRank + "." + counterMagicItem, String.valueOf(counterMagicItemRank + 1)); acroFields.setField("MagicalTreasureLPCost." + counterMagicItemRank + "." + counterMagicItem, String.valueOf(rank.getLpcost())); acroFields.setField("MagicalTreasureKeyKnowledge." + counterMagicItemRank + "." + counterMagicItem, rank.getKeyknowledge()); acroFields.setField("MagicalTreasureEffect." + counterMagicItemRank + "." + counterMagicItem, rank.getEffect()); if (counterMagicItemRank < weaventhreadrank) { acroFields.setField("ThreadMagicTarget." + counterThreadItem, item.getName()); acroFields.setField("ThreadMagicEffect." + counterThreadItem, rank.getEffect()); acroFields.setField("ThreadMagicLPCost." + counterThreadItem, String.valueOf(rank.getLpcost())); acroFields.setField("ThreadMagicRank." + counterThreadItem, String.valueOf(counterMagicItemRank + 1)); counterThreadItem++; } counterMagicItemRank++; } counterMagicItem++; } int counterBloodCharms = 0; for (MAGICITEMType item : character.getBloodCharmItem()) { acroFields.setField("BloodMagicType." + counterBloodCharms, item.getName()); if (item.getUsed().equals(YesnoType.YES)) { acroFields.setField("BloodMagicDamage." + counterBloodCharms, String.valueOf(item.getBlooddamage())); } else { acroFields.setField("BloodMagicDamage." + counterBloodCharms, "(" + item.getBlooddamage() + ")"); } acroFields.setField("BloodMagicDR." + counterBloodCharms, String.valueOf(item.getDepatterningrate())); acroFields.setField("BloodMagicEffect." + counterBloodCharms, item.getEffect()); counterBloodCharms++; } stamper.close(); }