可视化 告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存SVG图像

表生成器

SVG文件是基于XML格式的文档的二维矢量图像。SVG格式不仅用于描述二维矢量图形,而且还用于混合矢量光栅图像。span>

让我们看看SVG格式有哪些优点:

可视化 告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存SVG图像SVG

  1. 正如前面在上一篇文章中提到的,矢量图形缩放后不会失去质量(放大后,图像不会变成立体主义艺术)。
  2. SVG与web技术完全兼容,因此将成为任何web站点的有机组成部分。
  3. 将Javascript添加到对象中,我们可以使图像具有交互性,也就是说,用给定的答案来响应特定的用户操作——与图像及其形式相关。
  4. SVG文件被认为是文本,所以可以通过直接向图像代码添加关键字来优化文件,而不需要外部meta标记。

让我们看看SVG格式有哪些缺陷:

  1. 文件大小将迅速增加,就像雪崩时增加图像的细节。但是,对于包含大量细节的图像,最好使用PNG或JPG格式。因此,遗憾的是,SVG完全不适合用于真实的高分辨率照片和该地区的详细地图。
  2. 较老的浏览器(Internet Explorer 8或更老的浏览器)不支持SVG。
  3. 由于安全问题,默认情况下(例如WordPress)不允许你上传SVG文件。WordPress认为这个扩展是恶意的,因此阻止了它。
  4. SVG适合于创建简单的对象,这些对象可以通过简单的图形或其部件进行描述。
  5. 交 络,比如Facebook和Twitter,不支持SVG格式。如果使用SVG文件作为缩略图,将不得不使用插件和设置PNG或JPG的元标签。
如何使用Delphi或Lazarus保存SVG文件/strong>

创建 告。在我们创建了所需的东西之后,启动它并查看。调用预览并选择我们需要的格式。

可视化 告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存SVG图像

现在,我们看到一个具有许多不同设置的窗口。设置我们需要的一切,然后单击“确定”!

可视化 告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存SVG图像
使用Delphi / C ++ Builder / Lazarus代码保存SVG文件
procedure TForm1.Button1Click(Sender: TObject);begin {Generate a report. The report must be generated before exporting} frxReport1.PrepareReport(); {Set the range of pages to export. By default, all pages of the generated report are exported} frxSVGExport1.PageNumbers := '2-3'; {Set whether to export styles of the objects} frxSVGExport1.EmbeddedCSS := True; {Set whether to convert all images in accordance with PictureFormat:} {if the image in the report is in BMP format and the PictureFormat is PNG, then BMP will be saved in PNG format} frxSVGExport1.UnifiedPictures := True; {Set whether to format the source text of SVG (increases the size of the resulting file)} frxSVGExport1.Formatted := False; {Set whether to export pictures} frxSVGExport1.EmbeddedPictures := True; {Set whether to export each page to a separate SVG file} frxSVGExport1.Multipage := False; {Set whether to add navigation buttons to the resulting SVG file} frxSVGExport1.Navigation := False; {Set in which format to export pictures} //uses frxExportHelpers; // TfrxPictureFormat = (pfPNG, {$IFNDEF FPC}pfEMF,{$ENDIF} pfBMP, pfJPG);) frxSVGExport1.PictureFormat := pfPNG; {Set whether to open the resulting file after export} frxSVGExport1.OpenAfterExport := False; {Set whether to display export progress (show which page is currently being exported)} frxSVGExport1.ShowProgress := False; {Set whether to display the export filter dialog box} frxSVGExport1.ShowDialog := False; {Set the name of the resulting file.} {Please note that if you do not set the file name and disable the export filter dialog box,} {the file name selection dialog will still be displayed} frxSVGExport1.FileName := 'C:Outputtest.svg'; {Export the report} frxReport1.Export(frxSVGExport1);end;

让我们比较一下导出栅格和矢量对象的结果!将在下面提供JPEG和SVG示例。

JPEG格式

可视化 告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存SVG图像

SVG格式

可视化 告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存SVG图像

Fastreport在线下单立享85折起

!赶紧加入购物清单吧!

还想要更多吗可以点击阅读【FastReport 表2020最新资源盘点】查找需要的教程资源。如果您有任何疑问或需求,请随时加入FastReport技术交流群(),我们很高兴为您提供查询和咨询

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年7月13日
下一篇 2020年7月13日

相关推荐

发表回复

登录后才能评论