Free Support Forum -

How to set image output width and height

Trying to set the width and height on a JPG file converted from a PDF. Here is my code. Getting a failure status on convert saying "pdf.pdf conversion to Jpg: width and height should be greater then zero, but was: -2147483648 x -2147483648\r\nParameter name: bounds". Taking out the save option works fine.


var optionsImage = new ImageSaveOptions();

optionsImage.Width = 800;
optionsImage.Height = 800;

var optionsSave = new SaveOptions();

optionsSave.ImageSaveOptions = optionsImage;

ConversionJobResult convert_result = conversion_service.Convert(FileType.Jpg, optionsSave);


Thank you for the request. To resolve the issue simply add the DPI, for example: optionsImage.Dpi = 1600;

Best regards.

Hello this seems to be working now - the resizing - except for PDF file. Is there anything special that I need to do for PDF?


Thank you for coming back. No, I have tested with the pdf file (converted pdf to the jpg) and the solution described above worked well for me. Try to clean the cache (delete temp folder in the root storage) and try again.

Best regards.

Can you post the code you used? I am obviously just missing something.

Hi again,

I was able to reproduce the issue. Also we have released the next generation Conversion library which you can download here and here is a documentation for it. Please try to migrate to the new version and try with it. Could be that the issue is resolved in it.

Best regards.