Matlab,Visio等生成的图片的字体嵌入问题解决方法
确保所有字体嵌入,是生成高质量学术论文的必要条件。但是在Windows下,总会遇到Matlab或Visio生成字体没有嵌入的问题,当然这个问题的解决办法有很多(例如,对于Visio可以这样做:直接拷贝到Adobe Illustrator(AI)中,另存为eps(选择为“为其他程序嵌入字体”)),这里介绍一种批量式的解决方法。看到有网友介绍,可以用GhostScript来进行来回转换。安装好GhostScript后,在其安装文件夹下的bin目录下,会有gswin64c.exe这个可执行程序(我这里是64位系统,32位系统对应的就是gswin32c.exe),把没有字体嵌入的eps文件拷贝至该目录下,运行:
gswin64c.exe -dNOPAUSE -dBATCH -dEPSCrop -q -sDEVICE=pdfwrite -dCompatibilityLevel#1.3 -dPDFSETTINGS=/prepress -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=temp.pdf xxxx.eps
其中xxxx.eps就是需要转换的eps文件,这样生成了一个临时的temp.pdf文件,我们再运行下面的命令将临时pdf文件转为eps文件:
gswin64c.exe -q -dNOPAUSE -dBATCH -dNOCACHE -sDEVICE=epswrite -sOutputFile=yyyy.eps temp.pdf
其中yyyy.eps就是嵌入字体后的eps文件,通过这种方法,就可以将所有eps实现字体嵌入了。这样做固然方便,但是如果有很多文件需要处理,那手工运行命令还是挺复杂的。这里我提供一段简单的Java代码,我们可以将需要处理的eps文件都放在一个文件夹内,将文件夹拷贝到刚才说的bin目录下,在cmd方式下运行这段Java代码,可以批量实现转换(转换后的eps文件就在bin目录下,和原始文件文件名相同,但位置不同,这样可以方便LaTeX不进行任何修改就可以重新生成PDF)
import java.io.File;
import java.io.IOException;
public class gsBatch {
public static void main(String[] args) {
if(args.length!=1)
{
System.out.println("Usage: java gsBatch *Floder-to-handle*");
System.exit(0);
}
String absoluteStartPath = System.getProperty("user.dir");
File file = new File(absoluteStartPath+"\\"+args[0]);
gsBatch t = new gsBatch();
t.dotGenerator(file);
}
private void dotGenerator(File file) {
// TODO Auto-generated method stub
File[] fileList = file.listFiles();
int i=0;
while(i<fileList.length){
if (fileList[i].isDirectory()==true){
dotGenerator(fileList[i]);//使用递归方法对所有子目录分析
}
else if (fileList[i].getName().contains(".eps")){
String relativePath = file.getPath();
String commandConvertPDF = new String("cmd /c gswin64c.exe -dNOPAUSE -dBATCH -dEPSCrop -q -sDEVICE=pdfwrite -dCompatibilityLevel#1.3 -dPDFSETTINGS=/prepress -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=temp.pdf \""+relativePath+"\"\\"+fileList[i].getName());
System.out.println(commandConvertPDF);
String commandConvertEPS = new String("cmd /c gswin64c.exe -q -dNOPAUSE -dBATCH -dNOCACHE -sDEVICE=epswrite -sOutputFile="+fileList[i].getName()+" temp.pdf");
try {
Runtime.getRuntime().exec(commandConvertPDF);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try{Thread.sleep(1000);}
catch(Exception e){}
try {
Runtime.getRuntime().exec(commandConvertEPS);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try{Thread.sleep(1000);}
catch(Exception e){}
}
i++;
}
}
}
通过这种方法,就可以批量处理eps文件了(如果不会编译Java,则不用去考虑这种方法),最终生成的PDF文件可以用Acrobat等软件打开——文件——属性——字体,如果所有字体都显示“已嵌入子集”,则说明已经成功嵌入所有字体了。
Matlab,Visio等生成的图片的字体嵌入问题解决方法的更多相关文章
- EDAS字体嵌入问题解决方法
提交IEEE EDAS文章时出现:“The paper PDF file cannot be accepted: Publishers require that PDF fonts are embed ...
- Ubuntu下部分Java软件字体渲染问题解决方法
On ubuntu or in general Linux OS, fonts in some Java software(like Geogebra, Arduino) looks terriabl ...
- PHP 生成水印图片
这段时间因工作需要,学习了下用PHP来给背景图上添加公司logo,宣传语之类的图片合并功能.话不多说,直接上代码. <?php public function getImage() { $dat ...
- java web学习总结(九) -------------------通过Servlet生成验证码图片
一.BufferedImage类介绍 生成验证码图片主要用到了一个BufferedImage类,如下:
- JavaWeb---总结(九)通过Servlet生成验证码图片
一.BufferedImage类介绍 生成验证码图片主要用到了一个BufferedImage类,如下: 创建一个DrawImage Servlet,用来生成验证码图片 1 package gacl. ...
- Java 生成验证码图片
生成验证码图片并对提交的输入进行验证 // HttpServletResponse常见应用——生成验证码 // 利用BufferedImage类生产随机图片 public static final i ...
- javaweb学习总结(九)—— 通过Servlet生成验证码图片
一.BufferedImage类介绍 生成验证码图片主要用到了一个BufferedImage类,如下:
- 012. asp.net生成验证码图片(汉字示例/字母+数字)
protected void Page_Load(object sender, EventArgs e) { //生成验证码图片的基本步骤 string checkCode = "新年快乐& ...
- J2EE如何生成验证码图片和点击刷新验证码
验证码图片生成步骤 创建BufferedImage对象. 获取BufferedImage的画笔,即调用getGraphics()方法获取Graphics对象. 调用Graphics对象的setColo ...
随机推荐
- DropDownList SelectedIndexChanged使用
在asp.net中使用dropdownlist,默认是不会送的,我们想要选中一项然后更改相关的数据,应该吧属性AutoPostback改为true. http://msdn.microsoft.com ...
- hdu 4730 We Love MOE Girls
http://acm.hdu.edu.cn/showproblem.php?pid=4730 直接用string类处理字符串. AC代码: #include<iostream> #incl ...
- Mysql 的一些基本用法
一.增加字段 COMMENT '是否导入基础信息平台 1 是导入'; 二.删除字段 alter table `provincestudentinfo` drop column NativePlace; ...
- ThinkPHP - 查询语句
public function index(){ // + ----------------------- // | 查询语句 // + ----------------------- // 实例化模 ...
- oracle常用函数以及调用入参为record的存储过程的方法,
转自:http://www.cnblogs.com/zhangronghua/archive/2007/08/20/862812.html SQL中的单记录函数1.ASCII返回与指定的字符对应的十进 ...
- Python-zip压缩-解压
#打包成zip文件 import zipfile f = zipfile.ZipFile('archive.zip','w',zipfile.ZIP_DEFLATED) f.write('file_t ...
- 【集训笔记】计算几何【HDOJ2036【HDOJ1086【HDOJ1115【HDOJ1147【HDOJ1392 【ZOJ2976
改革春风吹满地 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted ...
- django中tag的用法
在app里建一个子的python包,包含__init__.py,包名为templatetags,里面新建一个tags.py(这个名字可以随意) from django import templater ...
- mvc中的几个数据传递
1.ViewData对象 ViewBagData是一种字典集合数据同时属于视图基类和控制器基类的属性. 实例: //控制器 public class HomeController:Controller ...
- 为什么国内的网盘公司都在 TB 的级别上竞争,成本会不会太高?(还有好多其它回复)
作者:杜鑫链接:http://www.zhihu.com/question/21591490/answer/18762821来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处 ...