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

Free Support Forum - aspose.com

PdfFileMend.addimage() resolution?


a little question about inserting images to a PDF. is it possible to manage the resolution of the inserted image? I have to insert 2D barcodes in my PDFs and need to have a least a 600 dpi images.

thanks in advance, and sorry for my bad english!


Thank you for considering Aspose.

I will check with the developers and inform you as soon as possible.



We have no way to manager resolution of image to be inserted in PDF file.
If you can provide your Barcode image to us, we will help you to test it and check if you can fulfil your requirement.



After testing,I think the resolution can be controled by setting the
size of the image. If the image is 600600 pixels and you set the image size to
1 inch, the resolution is 600dpi. If you set the image size to 22 inches, the
resolution is 300dpi. here is the code:

PdfFileMend mend = new PdfFileMend(“input.pdf”, “output.pdf”);
//if your image is 600
600 and resolution is 300dpi, then set width and height to 300, then resolution is set to 600dpi
mend.AddImage(“test.jpg”, 1, 0, 0, 300, 300);

Best regards,


thanks for the quick answer, it give me an idea on how to resolve my problem.

i’ll try to explain it here in case someone encounter the same difficulty I had:
to insert my image with the good size and resolution, I had to know the default pdf “resolution”.
I found it looking in the “aspose.pdf.kit.pagesize” properties wich gives the size of an A4 in pixel, comparing it with the real size of an A4 page, I found it’s 72 dpi.
all I have to do know is to convert my image using this method :

x = ImageWidth * (72/ImageResolution) and y = ImageHeight * (72/ImageResolution)

like this my inserted image have the same size and resolution than the base image.
hope this would serve to someone, and sorry again for bad english !