原創(chuàng)|其它|編輯:郝浩|2013-01-18 13:33:49.000|閱讀 219 次
概述:activePDF Toolkit不僅具有編輯功能,還能對(duì)文件實(shí)現(xiàn)合并,本次教程將給出文件合并的代碼示例:
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
activePDF Toolkit不僅具有編輯功能,還能對(duì)文件實(shí)現(xiàn)合并,本次教程將給出文件合并的代碼示例:
代碼示例如下:
// Copyright (c) 2013 activePDF, Inc. // Example created 01/17/13 // Make sure to add the activePDF product .NET DLL(s) to your application. // .NET DLL(s) are typically found in the products 'bin' folder. class Examples { public void main() { string strPath; int intOpenOutputFile; int intMergeFile; strPath = AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APToolkitNET.Toolkit oTK = new APToolkitNET.Toolkit(); // Create the new PDF file intOpenOutputFile = oTK.OpenOutputFile(strPath + "new.pdf"); if (intOpenOutputFile != 0) { ErrorHandler("OpenOutputFile", intOpenOutputFile); } // Set whether the fields should be read only in the output PDF // 0 mark all fields read-only, 1 leave fields as they are // Fields set with SetFormFieldData will not be effected oTK.ReadOnlyOnMerge = 1; // MergeFile is the equivalent of OpenInputFile and CopyForm // Merge the cover page (0 for all pages) intMergeFile = oTK.MergeFile(strPath + "cover.pdf", 0, 0); if (intMergeFile != 1) { ErrorHandler("MergeFile", intMergeFile); } // Merge the second PDF intMergeFile = oTK.MergeFile(strPath + "5pageLI.pdf", 0, 0); if (intMergeFile != 1) { ErrorHandler("MergeFile", intMergeFile); } // Merge the third PDF intMergeFile = oTK.MergeFile(strPath + "6pageAA.pdf", 0, 0); if (intMergeFile != 1) { ErrorHandler("MergeFile", intMergeFile); } // Close the new file to complete PDF creation oTK.CloseOutputFile(); // Release Object oTK = null; // Process Complete System.Diagnostics.Debug.WriteLine("Done!"); } // Error Handling public static void ErrorHandler(string strMethod, object rtnCode) { System.Diagnostics.Debug.WriteLine(strMethod + " error: " + rtnCode.ToString()); } }
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)