I would like to split the attached RTF document with different page size and convert it into PDF. As you can see, some images are cropped at the end. Can I somehow control, what should happen in such case? I would like to resize the current page or resize the image.
output.pdf (294.1 KB)
RTF_0_2_ImageSplitTest.zip (496.7 KB)
Yes, you can split or extract the desired content from the document and save them to PDF. You can also resize the image and resize the pages of Section.
Could you please ZIP and attach your expected output Word/PDF document here for our reference? We will then answer your query according to your requirement.
Hi Tahir,
as I wrote, I would like to resize the current page or resize the image.
Take the attached RTF, set the pages sizes circular to 15x8cm, 10x20cm, 7x7cm, and please explain me, how can I do both of them. The decision depends on the situation, page size, image size, customer settings, so I have to implement both of them, if it is possible.
Please note that you can change the width and size of pages in a Section. A section may has single or multiple pages in Word document. If you want to change the size of a page, you need to insert the section break on current page and its next page. After inserting the section break, you can use PageSetup.PageWidth and PageSetup.PageHeight properties as shown below to change the page size.
document.Sections[0].PageSetup.PageWidth = 500;
document.Sections[0].PageSetup.PageHeight = 500;
Regarding changing the size of image, you can use Shape.Width and Shape.Height properties.
Hi Tahir,
thanks for your answer!
It means, there is no automatic solution for this problem, I should iterate throught the nodes, check the type and set the page/shape size.
To change the size of image, you need to iterate over Shape nodes (image) and set the size of desired node.
Regarding changing the size of page, please note that Aspose.Words mimics the behavior of MS Word. To work with sections, we suggest you please create a document using MS Word, insert section breaks, and change the size of page. This image image.png (25.9 KB) shows how to insert section break into document.
Please read the following article to work with sections.
Working with Sections
You can get the section of specific page using Aspose.Words using Node.GetAncestor(NodeType.Section) method. We suggest you please read following article about Aspose.Words’ DOM.
Aspose.Words Document Object Model
Thx for the hints!