I am new to Aspose Word.Net and am working with a test license right now. I like what I see, but have the following question:
a) I have word documents that have their settings for page margins and need to render these to a Graphics object. I am using the following code:
PageInfo pageInfo = msWordDocument.GetPageInfo(pageNumber - 1);
float resolution = ppea.Graphics.DpiX;
Size imageSize = pageInfo.GetSizeInPixels(1.0f, resolution);
RectangleF rect = ComputePrintRectangleSize(ppea);
float scale = ComputePrintScale(imageSize, rect);
msWordDocument.RenderToScale(pageNumber - 1, ppea.Graphics, rect.Left, rect.Top, scale);
However, the file does not contain explicit page breaks and the image created does not match what is displayed in WORD. I places the top of the next page at the bottom of the first page. This happens in the DocumentViewer sample as well. How do I get the rendering to honor the page settings in the file?
Thank you,
Jeff
Hi
Jeffrey,
Thanks for your inquiry. I think, you can achieve what you need after using the code suggested in the following article:
Please let us know if you need more information, we are always glad to help you.
Best Regards,
Hi Jeff,
Thanks for your inquiry.
Probably Aspose.Words is having trouble rendering your document and is rendering it a little differently to how Microsoft Word displays it. Could you please attach your input document here for testing? We will take a closer look into this issue and provide you with some feedback.
Thanks,
I have attached a file that illustrates the problem. When you view the file in WORD, notice that the line "Page 2" is positioned at the top of the second page. In the DocumentExplorer sample and in my application which uses similar code, the line "Page 2" appears at the bottom of the first page.
Thanks for looking into this.
Jeff
Hi Jeff,
I have tested the scenario and able to reproduce the same problem at my end. I have logged this issue in our issue tracking system to resolve it. You will be notified via this forum thread once this issue is resolved.
We apologies for your inconvenience.
Hi Jeff,
Thanks for your patience. I suggest you please try the latest version of Aspose.Words for .NET 15.2.0 and let us know how it goes on your side. I have tested this scenario using Aspose.Words for .NET 15.2.0 and have not found this issue at my side. I have attached the output png file with this post for your kind reference.