找回密码
 立即注册

QQ登录

只需一步,快速开始

mindrayguowei
中级会员   /  发表于:2017-10-12 09:24:41
11#
抽了个简单的方法出来, 您看看

pdf.txt

2.68 KB, 下载次数: 66

回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-10-12 17:30:21
12#
因为我这边没有过多的tx文件,将代码稍许简化了一些,循环进行测试并没有发生错误,是否和你那边转换的文档本身有关,能否提供下,我这边进行测试

  1.         private  bool SaveToPDF(string localFile)
  2.         {
  3.             
  4.             try
  5.             {
  6.                 int index = 0;
  7.                 int times = 1000;

  8.                 while (index < times)
  9.                 {
  10.                     ServerTextControl serverTextControl = new ServerTextControl();

  11.                     try
  12.                     {
  13.                         SaveSettings saveSettings = new SaveSettings();
  14.                         
  15.                         serverTextControl.Create();
  16.                         serverTextControl.Load(localFile, StreamType.InternalUnicodeFormat);
  17.                         //serverTextControl.Save(remoteFile, StreamType.AdobePDFA, saveSettings);
  18.                         serverTextControl.Save(@"D:\des"+index+".pdf", StreamType.AdobePDF);  //这里会出错  
  19.                     }
  20.                     catch (Exception ex)
  21.                     {
  22.                         writeErrorlog(ex.Message);
  23.                         
  24.                     }
  25.                     finally
  26.                     {
  27.                         index++;
  28.                         serverTextControl.Dispose();

  29.                     }

  30.                 }


  31.                 return true;
  32.             }
  33.             catch (Exception ex)
  34.             {
  35.                 //LogAdapter.LogError(ex); //记录日志
  36.             }
  37.             finally
  38.             {
  39.                 try
  40.                 {
  41.                     File.Delete(localFile); //删除本地文件
  42.                 }
  43.                 catch (Exception ex)
  44.                 {
  45.                     //LogAdapter.LogError(ex); //记录日志
  46.                 }
  47.             }

  48.             return false;
  49.         }
复制代码
回复 使用道具 举报
mindrayguowei
中级会员   /  发表于:2017-10-13 11:00:41
13#
文档都在客户内网服务器上, 我想办法拿一批出来
回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-10-16 09:45:57
14#
好的
回复 使用道具 举报
mindrayguowei
中级会员   /  发表于:2017-11-1 15:30:44
15#
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)

一下是相关代码
  1. try
  2.                 {
  3.                     using (TXTextControl.ServerTextControl serverTextControl = new TXTextControl.ServerTextControl())
  4.                     {
  5.                         serverTextControl.Create();
  6.                         serverTextControl.Load(tempFile, TXTextControl.StreamType.InternalUnicodeFormat);
  7.                         serverTextControl.Selection.Start = 0;
  8.                         serverTextControl.Selection.Length = serverTextControl.Text.Length;
  9.                         serverTextControl.Selection.Underline = TXTextControl.FontUnderlineStyle.None;
  10.                         serverTextControl.Selection.ForeColor = System.Drawing.Color.Black;
  11.                         serverTextControl.Print(printDocument);

  12.                         break;
  13.                     }
  14.                 }
  15.                 catch (Exception ex)
  16.                 {
  17.                     LogAdapter.LogError("Print" + ex.Message);
  18.                     LogAdapter.LogError("Print" + ex.StackTrace);
  19.                 }
复制代码


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

cf5b5069-0725-41d0-812c-a81d00f54645.tx

87.8 KB, 下载次数: 94

回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-11-1 21:10:37
16#
mindrayguowei 发表于 2017-11-1 15:30
ServerTextControl的问题又出现了, 这次是打印tx文件, 日志里面的出错信息由点不一样
The operation could ...

明天早上拿这个文件进行测试后,给您答复
回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-11-2 11:11:56
17#
mindrayguowei 发表于 2017-11-1 15:30
ServerTextControl的问题又出现了, 这次是打印tx文件, 日志里面的出错信息由点不一样
The operation could ...

您好,我是在win10中进行的测试没有发现问题,winxp里面如果一直无法打印的话,需要考虑打印机以及系统版本的兼容性,您那边的打印问题目前是偶发错误还是压根没法打印呢?
回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-11-2 11:11:58
18#
mindrayguowei 发表于 2017-11-1 15:30
ServerTextControl的问题又出现了, 这次是打印tx文件, 日志里面的出错信息由点不一样
The operation could ...

您好,我是在win10中进行的测试没有发现问题,winxp里面如果一直无法打印的话,需要考虑打印机以及系统版本的兼容性,您那边的打印问题目前是偶发错误还是压根没法打印呢?
回复 使用道具 举报
mindrayguowei
中级会员   /  发表于:2017-11-2 13:45:16
19#
本帖最后由 mindrayguowei 于 2017-11-2 13:47 编辑

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

回复 使用道具 举报
Richard.Ma讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2017-11-6 09:11:03
20#
mindrayguowei 发表于 2017-11-2 13:45
压根没法打印,所有的tx文件都打不了, 这个和打印机没有关系, 就是servertextcontrol在load文件的时候出异常 ...

目前我们只能是先测试问题,确认后如果确实是bug会反馈给厂商,我们今天会专门用一个xp的机器进行相关的测试,客户方的环境,除了xp以外有什么其他的特殊情况,您知道的话也可以提供给我们
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部