找回密码
 立即注册

QQ登录

只需一步,快速开始

longgun119

论坛元老

6

主题

31

帖子

1万

积分

论坛元老

积分
13942

活字格认证

longgun119
论坛元老   /  发表于:2015-5-29 15:17  /   查看:13290  /  回复:12
C:\LEADTOOLS 19\Examples\DotNet\CS\DocumentViewerDemo
如何往DocumentViewer追加文件(即同时在DocumentViewer中加载多个文件)?

以下是我所写代码:
            using (var dlg = new UI.OpenDocumentFileDialog())
            {
                dlg.DocumentFileName = _preferences.LastDocumentFileName;
                dlg.AnnotationsFileName = _preferences.LastAnnotationsFileName;
                dlg.LoadEmbeddedAnnotations = _preferences.LastFileLoadEmbeddedAnnotations;
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    var options = new LoadDocumentOptions();
                    options.UseCache = DocumentFactory.Cache != null;

                    if (dlg.AnnotationsFileName != null)
                        options.AnnotationsUri = new Uri(dlg.AnnotationsFileName);
                    else
                        options.AnnotationsUri = null;

                    options.LoadEmbeddedAnnotations = dlg.LoadEmbeddedAnnotations;
                    Document document = DocumentFactory.LoadFromFile(dlg.DocumentFileName, options);
                    foreach (Leadtools.Documents.DocumentPage page in document.Pages)
                    {
                        _documentViewer.Document.Pages.Add(page);
                    }
                    _documentViewer.Commands.DocumentViewer.SetDocument(_documentViewer.Document);
                }
            }
每次执行到“_documentViewer.Document.Pages.Add(page);”这句时,会报“Page is already a member of a different document”的错误!

12 个回复

正序浏览
iceman
社区贡献组   /  发表于:2015-7-8 10:24:00
13#
回复 11楼longgun119的帖子

为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢   
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-6-10 16:33:00
12#
回复 11楼longgun119的帖子

如果没有其他问题,本帖关闭。
回复 使用道具 举报
longgun119
论坛元老   /  发表于:2015-6-10 15:36:00
11#
回复 10楼AvoCaDolol的帖子
O(∩_∩)O谢谢
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-6-10 13:32:00
10#
回复 9楼longgun119的帖子

您好,Document Viewer主要针对Page页面进行操作,对于Page来说是没有旋转这个操作的。
这就像Word文档一样,在Word中是没有将页面旋转的操作的。
如果需要旋转可以使用Image Viewer。
希望能帮助到您。
回复 使用道具 举报
longgun119
论坛元老   /  发表于:2015-6-10 11:26:00
9#
回复 8楼AvoCaDolol的帖子

有办法可以直接在DocumentViewer控件中实现?
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-6-8 10:51:00
8#
回复 7楼longgun119的帖子

您好,如果需要旋转的话,只能针对图片,Page是不能旋转的。
在这个Demo中,使用的是DocumentViewer控件,这个控件中只能显示文档,无法显示Image。
如果需要旋转的话,请示用ImageViewer,然后使用下面的代码:
           var page = this._documentViewer.Document.Pages[this._documentViewer.CurrentPageNumber];
            RotateCommand command = new RotateCommand();
            command.Angle = 90 * 100;
            command.FillColor = new RasterColor(255, 255, 255);
            command.Flags = RotateCommandFlags.Bicubic;
            command.Run(page.GetImage());
回复 使用道具 举报
longgun119
论坛元老   /  发表于:2015-6-5 13:35:00
7#
回复 6楼AvoCaDolol的帖子

在WinForm中做页面旋转(C:\LEADTOOLS 19\Examples\DotNet\CS\DocumentViewerDemo在这个demo中做旋转)
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-6-5 12:22:00
6#
回复 4楼longgun119的帖子

您好,
_documentViewer.Commands.Run(DocumentViewerCommands.ViewRotateClockwise, page_index);
这段代码中,DocumentViewerCommands.ViewRotateClockwise这个参数指的是将整个View都顺时针旋转90度。后面的page_index参数是无效的。

请问您是需要在WinForm中做页面旋转呢,还是Web上做页面旋转?
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-6-4 18:11:00
5#
回复 4楼longgun119的帖子

您好,您的问题已经收到,调查之后给您回复
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部