JSON - Specifying image_url, without height or width (automated scaling)

Product: PDFTron.NET.x64

Product Version: 10.11.0

Please give a brief summary of your issue:
I want to insert an image, using JSON, without a height and width specified - for a WORD document to PDF - the idea being the image to automatically scale to the width of it’s bounding box.

Please describe your issue and provide steps to reproduce it:
Find a large image, and reference it in a JSON structure, fill the template (which is docx).
Current Situation: The image overflows it’s page, cell or anything surrounding the tag.
Desired Outcome: The image scaled to the width of the bounding box

Please provide a link to a minimal sample where the issue is reproducible:

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


It seems like you’re trying to insert an image into a Word document template that will be converted to PDF, and you want the image to automatically scale to fit its bounding box. Unfortunately, the JSON data model for image insertion requires specifying either the dimensions (width and height) or the size property. If these are not specified, the image will not automatically scale and might overflow its container.

Some things you can try:

  • Specify both width and height properties in your JSON to control the image size explicitly.

  • Alternatively, use the size property with a CSS-like unit (e.g., “size”: “100%”) to have more control over the scaling behavior.

  • Ensure that the template itself has a defined size for the image container (e.g., table cell or paragraph) to help manage automatic scaling.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

We do not have an API that takes a JSON to do this but you can parse out the data from the JSON in your application then use either Apryse SDK Stamper or ElementBuilder to add the image to the document. Stamper is a simpler API not made for complex stamping, I think the ElementBuilder is what you are looking for which allows for more fine control over objects. I am providing some documentation on both for you to reveiw.

If you need more assistance can you send me the following to review.

  1. Input file(s)
  2. Generated output file(s)
  3. Code and settings used to generate (2) from (1)
  4. Screenshots showing the output, and clearly indicating what you expected to get instead, and also clearly indicating the application/browser being used to view.
1 Like