找回密码
 立即注册

QQ登录

只需一步,快速开始

dongxin5210

注册会员

7

主题

18

帖子

55

积分

注册会员

积分
55
dongxin5210
注册会员   /  发表于:2020-8-28 18:01  /   查看:2924  /  回复:4
AcitveReport12怎么导出PDF到本地

  Dim p As New Export.Pdf.Section.PdfExport()
            'GrapeCity.ActiveReports.Export.Pdf.v12
            p.Version = Export.Pdf.Section.PdfVersion.Pdf17

            'Set default print settings using PrintPresets class
            p.PrintPresets.PageScaling = Export.Pdf.Enums.PageScaling.None
            p.PrintPresets.DuplexMode = Export.Pdf.Enums.DuplexMode.DuplexFlipLongEdge
            p.PrintPresets.NumberOfCopies = Export.Pdf.Enums.NumberOfCopies.Two
            p.PrintPresets.PaperSourceByPageSize = True
            p.PrintPresets.PrintPageRange = "1-3"      
            p.Export(sectionReport.Document, Application.StartupPath + "\PrintPresets.pdf")



提示该应用程序未正确授权。

4 个回复

倒序浏览
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2020-8-28 18:54:45
沙发
你这是服务器导出包这个错误,还是本地导出出现这个问题。导出PDF可以参考这个代码
  1. // Provide the page report you want to render.
  2. System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
  3. GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);
  4. // Create an output directory.
  5. System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyPDF");
  6. outputDirectory.Create();
  7. // Add attachment.
  8. var pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
  9. // using GrapeCity.ActiveReports.Export.Pdf;        
  10. pdfSetting.Attachments.Add(new AttachmentInfo
  11. {
  12.     Name = "file.txt",
  13.     Content = System.IO.File.ReadAllBytes(@"D:\Reports\file.txt"),
  14.     Description = "attachment description" // optional
  15. });
  16. // or
  17. //{
  18. //   Name = "file.xml",
  19. //   Content = File.ReadAllBytes(Application.StartupPath + "\\file.xml")
  20. //};
  21. GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
  22. GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
  23. outputProvider.OverwriteOutputFile = true;
  24. pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);
复制代码


回复 使用道具 举报
dongxin5210
注册会员   /  发表于:2020-8-31 13:43:08
板凳
KearneyKang 发表于 2020-8-28 18:54
你这是服务器导出包这个错误,还是本地导出出现这个问题。导出PDF可以参考这个代码

本地导出错误,代码执行到 p.Export(sectionReport.Document, Application.StartupPath + "\PrintPresets.pdf")报错,一下是错误信息:

アプリケーションにライセンスが正しく付与されていません。プロジェクトにlicenses.licxファイルが存在し、内容が正しいことを確認の上、アプリケーションをビルドし直してください。詳細については、製品ヘルプの「アプリケーションのライセンスの組み込み」を参照してください。
回复 使用道具 举报
dongxin5210
注册会员   /  发表于:2020-8-31 14:10:58
地板
已解决,licenses.licx 文件缺少对PDF功能的授权信息,在licenses.licx文件添加以下代码:
GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport, GrapeCity.ActiveReports.Export.Pdf.v12
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2020-8-31 14:34:30
5#
好的,问题解决了就好
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部