Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging textsize in iText
    primarykey
    data
    text
    <p>I am trying to change the font property using iText, but can't get it work. Do you have any opinion about what is wrong with this code?</p> <pre><code>public static ByteArrayOutputStream createPersonnelReport(String sablonDir, String g,byte[] fotograf) { ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); BaseFont fontTimes = BaseFont.createFont(sablonDir + File.separator + fontName, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); PdfReader reader = new PdfReader(sablonDir + File.separator + tmSablonForSicilKaydiName); PdfStamper stamper = new PdfStamper(reader, baos); AcroFields form = stamper.getAcroFields(); PdfContentByte canvas = stamper.getOverContent(1); form.setField("g", g); boolean check=form.setFieldProperty("g", "textsize", new Float(26), null); System.out.println("check: "+ check); InputStream fotografImage = new ByteArrayInputStream(fotograf); BufferedImage bImageFromConvert = ImageIO.read(fotografImage); int type = bImageFromConvert.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : bImageFromConvert.getType(); BufferedImage dimensionedImage = resizeImage(bImageFromConvert, type); ImageIO.write(dimensionedImage, "jpg", new File("c:/yeniPersonelFoto.jpg")); Image image1 = Image.getInstance("c:/yeniPersonelFoto.jpg"); image1.setAbsolutePosition(450f, 650f); canvas.addImage(image1); stamper.setFormFlattening(true); stamper.close(); } catch (Exception e) { e.printStackTrace(); } finally { return baos; } } </code></pre> <p>EDIT: check: true returns in the output</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload