本帖最后由 Richard.Ma 于 2017-5-24 16:10 编辑
附件是在VS2017中编写的.NET4 C#演示程序,演示了如何使用ImageViewer Control以及Annotations SDK来浏览多页输入文档,向文档添加编辑对象,然后将文档平铺并保存为 300x300 8.5inx11in,无论输入的大小是多少。
要运行此项目,请确保输出路径设置为
引用:
C:\ LEADTOOLS 19 \ Bin \ Dotnet4 \ Win32
并且您有一个未过期的许可证
引用:
C:\ LEADTOOLS 19 \ Common \ License
以下是每个部分的相关代码:
为图像查看器中包含的每个页面添加一个容器:
- //Add an Annotation Container for each page to the Container Collection
- pageContainers.Clear();
- for (int page = 1; page <= imageViewer.Image.PageCount; page++)
- {
- AnnContainer pageContainer = new AnnContainer();
- pageContainer.Mapper.MapResolutions(imageViewer.Image.XResolution,
- imageViewer.Image.YResolution,
- imageViewer.Image.XResolution,
- imageViewer.Image.YResolution);
- pageContainer.Size = pageContainer.Mapper.SizeToContainerCoordinates(imageViewer.ImageSize.ToLeadSizeD());
- pageContainers.Add(pageContainer);
- }
- //Attach the first container to the annAutomation
- annAutomation.AttachContainer(pageContainers.FirstOrDefault(c => pageContainers.IndexOf(c) + 1 == imageViewer.Image.Page), null);
复制代码
调整大小并保存:
[code]//Burn each container to each page and then resize it to 300x300 DPI 8.5inx11in
RasterImage flatImage = null;
for (int page = 0; page < imageViewer.Image.PageCount; page++)
{
imageViewer.Image.Page = page + 1;
AnnWinFormsRenderingEngine renderer = annManager.RenderingEngine as AnnWinFormsRenderingEngine;
RasterImage flatPage = renderer.RenderOnImage(pageContainers |