c#实现pdf另存为功能

/// <summary>
/// PDF另存为效果
/// </summary>
/// <param name="fileName">PDF文件名</param>
/// <param name="saveFileName">另存结果文件名</param>
public static void PDFSaveAs(String fileName, string saveFileName)
{
Acrobat.CAcroPDDoc pdfDoc = null;
pdfDoc = (Acrobat.CAcroPDDoc)Microsoft.VisualBasic.Interaction.CreateObject("AcroExch.PDDoc", "");
if (!pdfDoc.Open(fileName)) { string.Format("源文件{0}不存在!", fileName); }
Object jsObj = pdfDoc.GetJSObject();
Type T = jsObj.GetType();
object[] saveAsParam = { saveFileName, "com.adobe.acrobat.tiff" }; //com.adobe.acrobat.tiff 表示TIFF文件
T.InvokeMember(
"saveAs",
BindingFlags.InvokeMethod |
BindingFlags.Public |
BindingFlags.Instance,
null, jsObj, saveAsParam);
pdfDoc.Close();
}

  转载:http://bbs.it-home.org/forum-net-2.html

05-08 14:56