冬眠兔兔 发表于 2019-7-5 14:29:55

程序导出的PDF和VS内预览模式导出的PDF不一样

使用版本:ActiveReportsNET11-v11.3.14330.1
VS版本:VS2017
开发语言:C# WinForm开发 Framework4.6.1
Report类型:SectionReport
现象:VS内预览模式导出的PDF()和使用代码PdfExport p = new PdfExport(); p.Export(section.Document, @"D:\123.pdf");导出的PDF,文字表示时有些微的差距。
内预览模式导出的PDF:
使用代码Export的PDF:
Report对象是同一个,是不是p.Export之前需要设定什么属性?

KearneyKang 发表于 2019-7-5 14:44:13

你的报表设置的字体是什么字体,建议使用字体是微软雅黑。然后你使用的导出PDF的代码是哪个建议使用这个:// Provide the page report you want to render.
System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);

// Create an output directory.
System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyPDF");
outputDirectory.Create();

// Provide settings for your rendering output.
GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();

// Reduce the report size and report generation time.
pdfSetting.OptimizeStatic = true;

// Set the rendering extension and render the report.
GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));

// Overwrite output file if it already exists
outputProvider.OverwriteOutputFile = true;

pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);


冬眠兔兔 发表于 2019-7-5 15:46:58

本帖最后由 冬眠兔兔 于 2019-7-5 15:52 编辑

KearneyKang 发表于 2019-7-5 14:44
你的报表设置的字体是什么字体,建议使用字体是微软雅黑。然后你使用的导出PDF的代码是哪个建议使用这个:
...
我使用的是字体是【MS 明朝】(项目需要,我使用的是日文版的ActiveReport)
然后我导出PDF用的代码是:
SectionReport section = new RP7331301();
section.ShowParameterUI = false;         
section.DataSource = dtTable;
section.Run();
PdfExport p = new PdfExport();
p.Export(section.Document, @"D:\123.pdf");
另外我使用的是SectionReport ,版主大大提供的方法也能使用么?

KearneyKang 发表于 2019-7-5 17:58:54

都是可以的,但是关于日文版本这块,我这边没办法根据你的日文版本做一个验证,实在不好意思
页: [1]
查看完整版本: 程序导出的PDF和VS内预览模式导出的PDF不一样