首页 > 编程语言 >Aspose.CAD测试记录

Aspose.CAD测试记录

时间:2023-02-17 09:44:11浏览次数:51  
标签:DGN PDF sourceFilePath 测试 pdf Aspose CAD

Aspose提供控件都是可以试用的,于是简单测试了下。
Aspose.CAD支持DGN转PDF,对于一些还使用station的图纸的确挺好。
Aspose转PDF不能使用SHX字体,这造成如果使用SHX字体,则无法使用Aspose.CAD转PDF。(参见:https://forum.aspose.com/t/text-missing-in-generated-pdf-from-dwg/201211)

Aspose.CAD can render only build-in system fonts. Autocad also uses it’s own .shx fonts. If such font type appears we change it with a default font during the rendering process. The Rasterization option contains the “Quality” property. To reduce result pdf file size you can user the following parameters:

rasterizationOptions.Quality.ObjectsPrecision = RasterizationQualityValue.Low; 
//the most influence option for result pdf file size 
rasterizationOptions.Quality.Text = RasterizationQualityValue.Low;

下面是DGN、DWG文件转PDF的效果

//DGN转PDF
      private void button1_Click(object sender, EventArgs e)
        {
            // This code example demonstrates how to convert DGN to PDF
            // Input DGN file
            string sourceFilePath = "Sample.dgn";

            // Load the DGN file
            DgnImage image = (DgnImage)Aspose.CAD.Image.Load(sourceFilePath);

            // Initialize PDF Options
            PdfOptions pdfOptions = new PdfOptions();

            // Save as PDF
            image.Save("sample_converted.pdf", pdfOptions);
        }
//dgn转dwg
        private void button2_Click(object sender, EventArgs e)
        {
            string sourceFilePath = "Sample.dgn";

            // Load the DGN file
            Aspose.CAD.Image image = (Aspose.CAD.Image)Aspose.CAD.Image.Load(sourceFilePath);

            // Initialize PDF Options
            PdfOptions pdfOptions = new PdfOptions();

            // Save as PDF
            image.Save("sample_convertedDWG.pdf", pdfOptions);
        }
//dwg转pdf
        private void button3_Click(object sender, EventArgs e)
        {
            string sourceFilePath = "Sample.dwg";

            Aspose.CAD.FileFormats.Cad.CadImage cadImage = (Aspose.CAD.FileFormats.Cad.CadImage)Aspose.CAD.Image.Load(sourceFilePath);
            foreach (CadStyleTableObject style in cadImage.Styles)
            {
                if (style.StyleName == "Roman")
                {
                    // Specify the font for one particular style
                    style.PrimaryFontName = "Arial";
                }
            }

        }

通过Aspose.CAD遍历图元没有测试。不过由于其转换带shx字体文件效果不好,因此就不考虑使用了。

标签:DGN,PDF,sourceFilePath,测试,pdf,Aspose,CAD
From: https://www.cnblogs.com/instr/p/17129058.html

相关文章

  • 随记一下之测试
    测试的分类手动测试:手动打开页面进行一个页面一个页面的测试。自动化测试:单元测试:测试的最小单元,测试底层功能函数,例如有一个数据库连接的文件,文件里的每一个方法都可......
  • 读Java实战(第二版)笔记12_重构、测试和调试
    1. 设计模式1.1. 对设计经验的归纳总结1.2. 一种可重用的蓝图1.3. Java5引入了for-each循环1.3.1. 替代了很多显式使用迭代器的情形1.4. Java7推出的菱形操......
  • Llvm 源码结构及测试基础
    Llvm源码结构及测试基础Llvm源码目录功能简介了解一下Llvm源码工程目录介绍、Llvm相关lib库的介绍、Llvm生成的工具链介绍,方便我们后期学习Llvm。LLVM源码工程目录介......
  • 测试流程管理
    1、项目排期 #项目名称状态QA提测时间测试时间备注1【CPA全真机考】测试中张增2020.2.12200.2.12-2020.2.17 ........
  • 自动化测试面试题
    一、你有没有做过自动化测试我在xx项目中实施了web自动化测试,我们项目中搭建自动化测试框架技术:python+selenium+unittest+ddt+jenkins,然后用的POM分层的模式(面向对象思想......
  • 开学测试
    要求Python编写程序爬取京东手机的评论数据,生成Json形式的数据文件。importrequestsimportjsonimportcsvfromlxmlimportetreefrombs4importBeautifulSoup......
  • python接口自动化13-API流量回放/锲约测试/自动化测试
    PPL-Tester简介http工具集,通过代理获取到API的请求与响应信息,将这些请求信息进行流量回放/锲约测试或快速生成用例,亦可通过人工进行修改参数化提取、变量引用、断言......
  • 与ChatGPT关于测试问题的对话
    1测试人员创造什么价值?测试人员在软件开发生命周期中扮演着非常重要的角色,他们的主要职责是确保软件在发布前达到高质量标准。以下是测试人员为软件开发和业务提供的价值......
  • Burp Suite Professional 2023.2 (macOS, Linux, Windows) - Web 应用安全、测试和扫
    BurpSuiteProfessional,Test,find,andexploitvulnerabilities.请访问原文链接:https://sysin.org/blog/burp-suite-pro-2023/,查看最新版。原创作品,转载请保留出处。......
  • CAD导入图片后怎么调整图片比例?
    在CAD制图过程中,有时候会需要将某张图片作为参照插入到图纸中,可是当CAD导入图片过大或者过小时,看起来便会非常不方便。那么,你知道CAD导入图片后怎么调整图片比例吗?接下来小......