Add image to fit to the page in Word Document with Aspose.Words Cloud API

Hi all


I need to create a word document where each page contains an image and the page size is set to image size. I found several examples about how to do this with the language related API’s but not how to achieve this with Aspose.Words for Cloud.

Can anyone help me as an Aspose newbie with a step by step example?

Hi Matthias,


Thanks for your inquiry. Unfortunately, Aspose.Words for Cloud does not provide feature to update image’s size. However, you can update the page’s margins and size.

Could you please attach your input and expected output Word documents here for our reference? We will then provide you more information about your query.

Hi Tahir


What I need is a word document similar to the one attached: an image on a page, where the page has the size of the image. Finally I’d like to save it as PDF.

Unfortunately I wasn’t able to find any entry point, e.g. to create an empty word document with proper page size nor to insert images in an existing document.

Best regards and thank you for your support,
Matthias

Hi Matthias,

Thanks for sharing the detail.

The “document” resource represents an individual document. Once document is uploaded to the Aspose.Words for Cloud infrastructure it is available at a specific URI.

In your case we suggest you please use “pageSetup” resource to change the page’s width and height according to image’s width and height. Please read following documentation link.

Update Page Setup of a Section in a Word Document

Please use API to get image’s width and height and use API resource to insert image in the document. To convert document to Pdf, please refer to the following documentation link. Hope this helps you.

Convert Word to Images, Multipage TIFF, HTML, PDF and other File Format using Cloud Storage