原創|其它|編輯:郝浩|2013-01-05 09:49:15.000|閱讀 329 次
概述:作為一款強大的生成修改工具,activePDF Toolkit能夠實現一切PDF相關的功能。本文是關于創建和導出功能的示例介紹。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
作為一款強大的PDF生成修改工具,activePDF Toolkit能夠實現一切PDF相關的功能。本文是關于創建和導出功能的示例介紹。
代碼如下:
// Copyright (c) 2013 activePDF, Inc. // Example created 01/03/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 intOpenInputFile; int intCopyForm; string strXMLData; strPath = AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APToolkitNET.Toolkit oTK = new APToolkitNET.Toolkit(); // This example will take a PDF and add a comment to it // then it will extract the comment from the new PDF // Create the new PDF file intOpenOutputFile = oTK.OpenOutputFile(strPath + "new.pdf"); if (intOpenOutputFile != 0) { ErrorHandler("OpenOutputFile", intOpenOutputFile); } // Open the template PDF intOpenInputFile = oTK.OpenInputFile(strPath + "PDF.pdf"); if (intOpenInputFile != 0) { ErrorHandler("OpenInputFile", intOpenInputFile); } // Add a comment to first page of the input PDF oTK.AddComment(72.0f, 660.0f, 144.0f, 100.0f, "Lorem Ipsum", "Test", 0, 128, "#BEBEBE", true, 1, "John Doe", "Lorem"); // Copy the template (with any changes) to the new file intCopyForm = oTK.CopyForm(0, 0); if (intCopyForm != 1) { ErrorHandler("CopyForm", intCopyForm); } // Close the new file to complete PDF creation oTK.CloseOutputFile(); // Open the PDF with a comment intOpenInputFile = oTK.OpenInputFile(strPath + "new.pdf"); if (intOpenInputFile != 0) { ErrorHandler("OpenInputFile", intOpenInputFile); } // Extract the comments as XML Data to a variable // Use the strXMLData variable to handle the XML data strXMLData = oTK.ExportComments(0); // Close the PDF input file oTK.CloseInputFile(); // 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()); } }
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網