We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How do I add text to an image?

The code below has created a function to insert text into the image.

Does the pdf api have that function?

public static void main(String[] args) {

	 try {
		final BufferedImage image = ImageIO.read(new URL("http://localhost:8080/img/watermark_emro_s.gif"));
		Graphics g = image.getGraphics();
		Color c = new Color(0,0,0);
		int height = image.getHeight() / 2;
		int width = image.getWidth() / 2;
		g.drawString("2020/03/26", width-30, height + 27);
		ImageIO.write(image,"gif", new File("D:\\test.gif"));
	} catch (MalformedURLException e) {
		// TODO Auto-generated catch block
	} catch (IOException e) {
		// TODO Auto-generated catch block

test.gif (11.0 KB)


We are afraid that Aspose.PDF does not support processing/manipulating images. It is dedicated to perform operations over PDF documents. In case you have further inquiry, please feel free to ask.

Thank you for your reply.