91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 14.99MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2023-06-29
  • 語言: 其他
  • 標簽: Acrobat??word2pdf??

資源簡介

利用 Acrobat pdf 虛擬打印機來生成pdf ,但是會有錯誤。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Diagnostics;
using?System.Drawing.Printing;
using?System.IO;
using?System.Linq;
using?System.Text;
using?Microsoft.Office.Interop.Word;
using?Microsoft.Win32;

namespace?Acrobat.word2pdf1
{
????class?Program
????{

????????private?string?adobePdfPrint?=?“Adobe?PDF“;
????????private?string?adobeDisPrint?=?“Acrobat?Distiller“;
????????private?string?regRoot?=?“SOFTWARE//Adobe//Acrobat?Distiller//“;
????????private?string?printerFileName?=?“acrodist.exe“;
????????private?string?regName?=?“InstallPath“;

????????///?
????????///?獲取acrodist.exe的安裝路徑
????????///?

????????///?
????????private?string?GetAdobeDisFilePath()
????????{
????????????RegistryKey?regKey?=?null;
????????????RegistryKey?acrodistKey?=?null;
????????????string?printerName?=?string.Empty;
????????????int?i;
????????????string?regRootVersion?=?string.Empty;

????????????regKey?=?Registry.LocalMachine;
????????????//?acrodist的4-8版本適用
????????????for?(i?=?4;?i?????????????{
????????????????regRootVersion?=?string.Format(“{0}{1}.0“?regRoot?i);
????????????????acrodistKey?=?regKey.OpenSubKey(regRootVersion);

????????????????if?(acrodistKey?!=?null)
????????????????{
????????????????????printerName?=?acrodistKey.GetValue(regName?““)?+?“//“?+?printerFileName;
????????????????????if?(File.Exists(printerName))
????????????????????{
????????????????????????return?printerName;
????????????????????}
????????????????}
????????????}
????????????throw?new?Exception(“Acrobat?Distiller?printer?not?found!“);
????????}

????????///?
????????///?獲取Adobe?Printer?
????????///?“Adobe?PDF“?或?“Acrobat?Distiller“?
????????///?

????????///?
????????private?string?GetAdobePrinter()
????????{
????????????foreach?(string?printername?in?PrinterSettings.InstalledPrinters)
????????????{
????????????????if?(printername.ToUpper().IndexOf(adobePdfPrint.ToUpper())?!=?-1?||?printername.ToUpper().IndexOf(adobeDisPrint.ToUpper())?!=?-1)
????????????????{
????????????????????return?printername;
????????????????}
????????????}
????????????return?string.Empty;
????????}

????????public?void?ConvertWord2Pdf(string?sourceFile)
????????{
????????????Microsoft.Office.Interop.Word.ApplicationClass?word?=?null;
????????????Microsoft.Office.Interop.Word.Document?doc?=?null;
????????????object?paramMissing?=?Type.Missing;
????????????object?paramSourceDocPath?=?sourceFile;

????????????try
????????????{
????????????????if?(PrinterSettings.InstalledPrinters.Count?==?0)
????????????????????throw?new?Exception(“Did?not?find?the?printer?please?install?the?printer.“);

????????????????if?(!File.Exists(sourceFile))
????????????????????throw?new?Exception(string.Format(“File?not?found:{0}“?sourceFile));

????????????????string?strDir?=?Path.GetDirectoryName(sourceFile);

????????????????string?strName?=?Pa

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-02-22?19:56??Acrobat.word2pdf1\
?????文件????29458320??2012-02-22?19:52??Acrobat.word2pdf1\Acrobat.dll
?????文件????????3181??2012-02-22?19:54??Acrobat.word2pdf1\Acrobat.word2pdf1.csproj
?????文件??????781104??2012-02-22?19:53??Acrobat.word2pdf1\Microsoft.Office.Interop.Word.dll
?????文件????????7732??2012-02-22?19:56??Acrobat.word2pdf1\Program.cs
?????目錄???????????0??2012-02-22?19:51??Acrobat.word2pdf1\Properties\
?????文件????????1378??2012-02-22?19:51??Acrobat.word2pdf1\Properties\AssemblyInfo.cs

評論

共有 條評論