try {
Image pdfImage = Image.getInstance(image, null);
pdfImage.setAbsolutePosition(0, 0);
pdfImage.scaleToFit(width, height);
PdfTemplate template = contentByte.createTemplate(image.getWidth(), image.getHeight());
template.addImage(pdfImage);
final float leftMargin = document.leftMargin();
contentByte.addTemplate(template, leftMargin + x, y);
} catch (BadElementException e) {
throw new GeracaoBoletoException(e);
} catch (DocumentException e) {