Foxtable(狐表)用户栏目专家坐堂 → foxtable 自带的PDF生成功能异常


  共有5365人关注过本帖平板打印复制链接

主题:foxtable 自带的PDF生成功能异常

帅哥哟,离线,有人找我吗?
ljh29206
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1359 积分:12010 威望:0 精华:0 注册:2012/3/5 11:32:00
foxtable 自带的PDF生成功能异常  发帖心情 Post By:2017/10/23 16:01:00 [只看该作者]

Dim fl As String = "d:\abc.pdf"
Dim a As Integer = 0

'--------------------------------------------------------------对生成的图片进行批量处理,然后放入同一个PDF文件里面
Dim doc As New PrintDoc '定义一个报表对象
doc.PageSetting.Landscape = True '横向打印
'doc.PageSetting.PaperKind = 70 '纸张类型改为B5
doc.PageSetting.Width = 210 '纸张宽度为220毫米
doc.PageSetting.Height = 91 '纸张高度为110毫米
doc.PageSetting.LeftMargin = 1   '设置页边距
doc.PageSetting.RightMargin = 0
doc.PageSetting.TopMargin = 0
doc.PageSetting.BottomMargin = 0
'--------------------设置页面
'--------------------添加图片到PDF

For Each str As String In FileSys.GetFiles("d:\cutoff\")
    Dim ifo As new FileInfo(str)
  '  If str.Contains("jpg")  AndAlso ifo.Length > 30000 Then  'ifo.Length > 50000 让文件的大小大于 50k   避免空页面加载
        a = a + 1
        Dim rt As prt.RenderText '定义一个文本对象
        rt = New prt.RenderText() '创建文本对象
        rt.Style.FontBold = True '字体加粗
        rt.Style.FontSize = 9 '字体大小为9磅
        rt.Text = "(" & a & " / " & FileSys.GetFiles("d:\cutoff\").Count  & ")"  '设置文本对象的内容
        rt.Width = "Auto" '自动设置宽度
        rt.X = 62 '指定水平位置
        rt.y = 75 '指定垂直位置
        
        Dim rm As New prt.RenderImage '定义一个图片对象
        rm.Image = GetImage(str) '设置图片
        rm.Width = "109%Parent"
        rm.Height = "100%Parent"
        rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Left
        rm.Style.ImageAlign.AlignVert = prt.ImageAlignVertEnum.top
        rm.Style.ImageAlign.KeepAspectRatio = False
        doc.Body.Children.Add(rm) '将图片对象加入报表
        doc.Body.Children.Add(rt) '将文本对象加入到报表
'    End If
Next

'--------------------生成页面
doc.SavePDF(fl) '保存为PDF文件

代码以上  ,
把图片 复制 为  以 25 ,50 ,100 张 进行测试 
发现25,50 可以通过,
100张时 就会失败, 请 指点.

请测试

大概60+ 的时候会提示内存不足.

[此贴子已经被作者于2017/10/25 15:27:24编辑过]

 回到顶部