【老徐子傑】PDFの画像転送方法(中国語の文字化けしを解決する)
9082 ワード
【老徐子傑】PDFの画像転送方法(中国語の文字化けしを解決する)
交流使用を歓迎します(本文オリジナル:転載は出典を明記してください)
プロジェクトをしている間に、大企業が解読版のDLLを使って開発することは正直あり得ません.だからADOBEの组み立ては使わないで、基本的なBIMPの回転法は各种の中国语の文字に直面して、回転してきっと文字化けします.だから私はオープンソースのPDF回転PNG、TIF、さらにWORDツールを見つけました.GhostScriptはgsと略称します.簡単です.複雑なコードを書かずに簡単に呼び出せばいいです.では、始めましょう.
ツールの準備
1.gs 909 w 32をダウンロードする.exeインストーラ名の意味(gs 9.09版32位)より高いバージョンをお勧めします:国外からダウンロードしなければなりませんCSDNから必要ありません高いのでお金があればどうでもいいです.C#とjavaは原理を使うことができます:CMDプログラムを呼び出してCMDに対して呼び出し方法を入力します.その他はGS処理に任せる.簡単じゃないの?
コードC#
//それくらいですが、わからないことがあればQ 732288837に聞くのは簡単でしょう.
交流使用を歓迎します(本文オリジナル:転載は出典を明記してください)
プロジェクトをしている間に、大企業が解読版のDLLを使って開発することは正直あり得ません.だからADOBEの组み立ては使わないで、基本的なBIMPの回転法は各种の中国语の文字に直面して、回転してきっと文字化けします.だから私はオープンソースのPDF回転PNG、TIF、さらにWORDツールを見つけました.GhostScriptはgsと略称します.簡単です.複雑なコードを書かずに簡単に呼び出せばいいです.では、始めましょう.
ツールの準備
1.gs 909 w 32をダウンロードする.exeインストーラ名の意味(gs 9.09版32位)より高いバージョンをお勧めします:国外からダウンロードしなければなりませんCSDNから必要ありません高いのでお金があればどうでもいいです.C#とjavaは原理を使うことができます:CMDプログラムを呼び出してCMDに対して呼び出し方法を入力します.その他はGS処理に任せる.簡単じゃないの?
コードC#
// name 。
StringBuilder str = new StringBuilder();
// CMD
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false; // shell
p.StartInfo.RedirectStandardInput = true;//
p.StartInfo.RedirectStandardOutput = true;//
p.StartInfo.RedirectStandardError = true;//
p.StartInfo.CreateNoWindow = true;//
p.Start();// CMD
// cmd
//
p.StandardInput.WriteLine(ConfigurationSettings.AppSettings["DISK"]);//
// cd BIN
p.StandardInput.WriteLine("cd " + ConfigurationSettings.AppSettings["StuepPath"]);//cd
p.StandardInput.AutoFlush = true;
// GS909W32.EXE
//
// ConfigurationSettings.AppSettings["OutPutPath"] + @"\" + name + ".tif" TIF tif
// ConfigurationSettings.AppSettings["Path"] + @"\" + name + ".pdf" PDF
// 。 。 bin C C gswin64 C
str.AppendFormat(@"gswin64.exe -r600*600 -g4960x7020 -q -dNOPAUSE -sDEVICE=tiffg4 -sOutputFile={0} {1} -c quit", ConfigurationSettings.AppSettings["OutPutPath"] + @"\" + name + ".tif", ConfigurationSettings.AppSettings["Path"] + @"\" + name + ".pdf");
p.StandardInput.WriteLine(str);// CMD str
p.StandardInput.WriteLine("exit");//
string output = p.StandardOutput.ReadToEnd();// CMD
Console.WriteLine("CMD
" + output+"
");
log.WriteToPrintLog("
" + output, name);
p.WaitForExit();//
p.Close();
}
//それくらいですが、わからないことがあればQ 732288837に聞くのは簡単でしょう.