Hi i'm trying to add an image to my pdf. It's getting added but the problem is i'm not able to set user defined width and height. I'm using XMLWorkerHelper
to convert the HTML code and write it in PDF.
try {
String image="<img alt=\"Not Loading\" src=\"C:\\Users\\sathesh_S\\Desktop\\Itext\\football.jpg\" style=\"width: 50px; height: 75px\" />";
OutputStream file = new FileOutputStream(new File("C:\\Test.pdf"));
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, file);
document.open();
InputStream is = new ByteArrayInputStream(image.getBytes());
XMLWorkerHelper.getInstance().parseXHtml(writer, document, is);
document.close();
file.close();
}
catch (Exception e)
{
e.printStackTrace();
}
Here i'm setting the width and height as 50 and 75 pixel. But the original image is getting added to the PDF. How can i rectify this.