DWG转PDF字体研究记录

1.前言

       最近需要对PDF中的符合业务规则的文字进行提取,发现有些文字不是文字信息形式存储,而是polyline形式表达,意味着仅仅有形体上的表达,丢失了原本的文字信息。

经过沟通得知,这些PDF是AutoCAD软件导出的,拿到原始dwg文件进行了测试和研究。

2.记录

AutoCAD、ODA等软件中导出PDF时都支持是否将文字处理为几何导出,如下图,其中ODA的设置要更丰富些,包括TrueType字体、SHX字体的导出设置。

其他PDF相关软件工具也针对字体有不同的处理措施。

为什么关于DWG <——>PDF之间的互转关于字体话题有这么丰富的内容呢?究其原因是DWG中为了支持更丰富的字体样式(包括建筑行业中的专业符号等,如钢筋符号)表达引入了SHX字体,而PDF不支持SHX类型字体,因此一些软件、工具在处理DWG和PDF的互通时就有n多的补偿措施,且这些补偿措施是不统一的,也就产生了信息损失情况下的互转质量高低的感官,但无论如何都可能会有信息损失。

{
"呼吁": "PDF何时能支持SHX字体类型?或有其他让DWG、PDF无损互转的方案吗?"
}

下面我们一起来扒一扒各软件工具关于此议题的(补偿)处理措施。 

2.1 AutoCAD

2.1.1 导出PDF

nullicon-default.png?t=N7T8https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/How-to-create-selectable-and-searchable-text-in-a-PDF-from-AutoCAD.htmlHelpicon-default.png?t=N7T8https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-EC9C6D47-814E-476D-840F-04104CF72B78

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/How-to-create-selectable-and-searchable-text-in-a-PDF-from-AutoCAD.html
 

2016版以前会将shx字体导出为光栅化的图片,2016及以后版本支持导出为矢量(polyline)+PDF注释信息,注意导出为PDF注释信息是补偿措施,因为只有几何上的形体显然不能满足某些场景的需求(比如提取文字内容)。

当然也有一些其他工具支持DWG导出为PDF,且对shx文字有对应处理。

2.1.2 导入PDF 

 https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-1202CC8A-364F-4E93-8E86-6F476CD83C72


autocad说明里面值保留TRUE TYPE FONT,但是不可能让用户使用ttf字体的,偏离了目的,图纸字体效果就变了。

同时提供了工具命令(PDFSHXTEXT)以支持用户将指定的,原始为shx字体的几何“拟合”还原为文字,同样,这是对于PDF涉及到SHX字体的补偿措施。

2.2 ODA

2.2.1 导出PDF

ODA支持是否SHX字体导出为geometry选项,

  1. 如果勾选时导出为polyline或者三角面;
  2. 如果不勾选应该是将dwg中的shx字体统一替换为TTF(True Type Font)字体,然后导出,这样就有了完整的字体信息,代价是shx字体文字形体上发生了变化。 

 

2.2.2 导入PDF 

同样提供了丰富的“补偿措施”以提高信息保真程度,在流畅性等需求的平衡中。

 ODA Drawings SDKicon-default.png?t=N7T8https://docs.intellicad.org/files/oda/2021_11/oda_drawings_docs/frames.html?frmname=topic&frmfile=Importing_from_a_PDF_file.html

2.3 Adobe

据称,Adobe有一款杰出的转换工具,嗯,不妨试一试。

尝试安装了下,有试用时间,但在尝试将dwg转为pdf功能时失败了,给出的的提示是在windows系统上无法使用此功能。。。

这是adobe关于字体的说明。 

https://helpx.adobe.com/my_en/acrobat/using/pdf-fonts.html

2.4 其他

blue beam:

Raster, Vector and Text - What's Really in My PDF?How to determine whether your PDF is raster- or vector-based, and how this affects the ability to snap to an object or select text. Relevant Products for Windows and Revu for Mac You're unable to snap to an object when taking measurements. You cannot select or search for text. Why does this happen? The reason both of these occur is that PDFs aren't all created in the same way. Some PDFs contain more information than others, even though they seem indistinguishable at first. The page may appear to contain lines and characters, but the underlying elements that represent them in the PDF may not be vector lines and text elements, which are needed to snap to content and search and select text. Raster vs. Vector Content Let's look at the difference between raster and vector content in a PDF. Raster PDF Vector PDF A raster image is created from a series of square dots called pixels. One example of a raster PDF is a file created from scanning a paper. A scanned PDF is createdicon-default.png?t=N7T8https://support.bluebeam.com/articles/raster-vector-and-text-whats-really-in-my-pdf/

aspose:

Text missing in generated PDF from DWG - Free Support Forum - aspose.comI convert a dwg file to pdf , but some texts(shx font) do not display(blank) then i try to call ‘setPrimaryFontName’ method but useless; so do you support display shx font text? thank you. i attached the dwg file and…icon-default.png?t=N7T8https://forum.aspose.com/t/text-missing-in-generated-pdf-from-dwg/201211

4 Ways to Convert DWG to PDF With/Without AutoCAD (Free Incl.):

4 Ways to Convert DWG to PDF With/Without AutoCAD (Free Incl.)In this article, you can receive 4 easy and workable ways to convert DWG to PDF, whether you have or haven’t AutoCAD on your computer.icon-default.png?t=N7T8https://www.cisdem.com/resource/convert-dwg-to-pdf.html

3.写在后面

这也和提升dwg字体相关显示效率议题相关。

有意思的是老外将中文、日文和朝鲜文等成为亚洲文字( Asian Font),单独作为文字领域的一个范畴来研究处理 。

"PDF何时能支持SHX字体类型?或有其他让DWG、PDF无损互转的方案吗?"

在当前的情况下结合各软件及提供的各种设置,尝试去寻找适合对应业务场景的方案。

  • 19
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值