mindrayguowei 发表于 2017-10-12 09:24:41

抽了个简单的方法出来, 您看看

Richard.Ma 发表于 2017-10-12 17:30:21

因为我这边没有过多的tx文件,将代码稍许简化了一些,循环进行测试并没有发生错误,是否和你那边转换的文档本身有关,能否提供下,我这边进行测试

      privatebool SaveToPDF(string localFile)
      {
            
            try
            {
                int index = 0;
                int times = 1000;

                while (index < times)
                {
                  ServerTextControl serverTextControl = new ServerTextControl();

                  try
                  {
                        SaveSettings saveSettings = new SaveSettings();
                        
                        serverTextControl.Create();
                        serverTextControl.Load(localFile, StreamType.InternalUnicodeFormat);
                        //serverTextControl.Save(remoteFile, StreamType.AdobePDFA, saveSettings);
                        serverTextControl.Save(@"D:\des\"+index+".pdf", StreamType.AdobePDF);//这里会出错
                  }
                  catch (Exception ex)
                  {
                        writeErrorlog(ex.Message);
                        
                  }
                  finally
                  {
                        index++;
                        serverTextControl.Dispose();

                  }

                }


                return true;
            }
            catch (Exception ex)
            {
                //LogAdapter.LogError(ex); //记录日志
            }
            finally
            {
                try
                {
                  File.Delete(localFile); //删除本地文件
                }
                catch (Exception ex)
                {
                  //LogAdapter.LogError(ex); //记录日志
                }
            }

            return false;
      }

mindrayguowei 发表于 2017-10-13 11:00:41

文档都在客户内网服务器上, 我想办法拿一批出来

Richard.Ma 发表于 2017-10-16 09:45:57

好的

mindrayguowei 发表于 2017-11-1 15:30:44

ServerTextControl的问题又出现了, 这次是打印tx文件, 日志里面的出错信息由点不一样
The operation could not be performed. An unexpected error has occurred. (03-1008)

at TXTextControl.LoadSettings.?(String , StreamType , TextControlCore , ? )
at TXTextControl.ServerTextControl.Load(String path, StreamType streamType)
at Maroland.TXControl.TXControlDocument.Print(String reportPath, PrintDocument printDocument)

一下是相关代码
try
                {
                  using (TXTextControl.ServerTextControl serverTextControl = new TXTextControl.ServerTextControl())
                  {
                        serverTextControl.Create();
                        serverTextControl.Load(tempFile, TXTextControl.StreamType.InternalUnicodeFormat);
                        serverTextControl.Selection.Start = 0;
                        serverTextControl.Selection.Length = serverTextControl.Text.Length;
                        serverTextControl.Selection.Underline = TXTextControl.FontUnderlineStyle.None;
                        serverTextControl.Selection.ForeColor = System.Drawing.Color.Black;
                        serverTextControl.Print(printDocument);

                        break;
                  }
                }
                catch (Exception ex)
                {
                  LogAdapter.LogError("Print" + ex.Message);
                  LogAdapter.LogError("Print" + ex.StackTrace);
                }

在windows xp系统下做打印操作, 但是所有的tx文件全都打印不了, 应该是和tx文件本身没关系了.究竟要怎么解决这类问题啊, servertextcontrol出错的问题已经在好多客户的好多场景下都遇到过了, 这个体验非常不好.
我拿了一个tx文件回来, 在附件里面.

Richard.Ma 发表于 2017-11-1 21:10:37

mindrayguowei 发表于 2017-11-1 15:30
ServerTextControl的问题又出现了, 这次是打印tx文件, 日志里面的出错信息由点不一样
The operation could ...

明天早上拿这个文件进行测试后,给您答复

Richard.Ma 发表于 2017-11-2 11:11:56

mindrayguowei 发表于 2017-11-1 15:30
ServerTextControl的问题又出现了, 这次是打印tx文件, 日志里面的出错信息由点不一样
The operation could ...

您好,我是在win10中进行的测试没有发现问题,winxp里面如果一直无法打印的话,需要考虑打印机以及系统版本的兼容性,您那边的打印问题目前是偶发错误还是压根没法打印呢?

Richard.Ma 发表于 2017-11-2 11:11:58

mindrayguowei 发表于 2017-11-1 15:30
ServerTextControl的问题又出现了, 这次是打印tx文件, 日志里面的出错信息由点不一样
The operation could ...

您好,我是在win10中进行的测试没有发现问题,winxp里面如果一直无法打印的话,需要考虑打印机以及系统版本的兼容性,您那边的打印问题目前是偶发错误还是压根没法打印呢?

mindrayguowei 发表于 2017-11-2 13:45:16

本帖最后由 mindrayguowei 于 2017-11-2 13:47 编辑

压根没法打印,所有的tx文件都打不了, 这个和打印机没有关系, 就是servertextcontrol在load文件的时候出异常了.不要说你那儿测试是正常的, 我本地也是正常的.但是到客户那边就不正常, 我现在已经没办法和客户解释这个问题了.
别的购买了你们这个产品的公司就没有遇到过我这个问题吗?

Richard.Ma 发表于 2017-11-6 09:11:03

mindrayguowei 发表于 2017-11-2 13:45
压根没法打印,所有的tx文件都打不了, 这个和打印机没有关系, 就是servertextcontrol在load文件的时候出异常 ...

目前我们只能是先测试问题,确认后如果确实是bug会反馈给厂商,我们今天会专门用一个xp的机器进行相关的测试,客户方的环境,除了xp以外有什么其他的特殊情况,您知道的话也可以提供给我们
页: 1 [2] 3
查看完整版本: servertextcontrol保存tx文件到PDF出错.