Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.PDF for .NET是一个组件,它还提供编辑和操作现有PDF文件的能力。Aspose为.NET和Java提供此组件,可以在您的.NET和Java应用程序中使用,只需访问该组件的API。然而,将Aspose.PDF for .NET与Coldfusion集成的方法略有不同。本文将详细探讨这一点。
为了能够在Coldfusion中运行Aspose.PDF for .NET,您需要IIS、.NET 2.0和Coldfusion。我已经使用IIS 5、.NET 2.0和Coldfusion 8测试了该组件。在安装Coldfusion时,您还需要确保两件事。首先,您必须指定在IIS下将运行Coldfusion的站点。其次,您需要从Coldfusion安装程序中选择“.NET集成服务”。 .NET集成服务允许您在Coldfusion应用程序中访问.NET组件程序集;在这种情况下,该组件将是Aspose.PDF for .NET。
首先,您必须将DLL(Aspose.PDF .dll)复制到一个位置,以便您可以在后续使用中访问它;这将被设置为路径并分配给cfobject标签的assembly属性,如下所示:
<cfobject type = ".NET" name = "fileinfo"
class = "Aspose.Pdf.Facades.PdfFileInfo"
assembly = "C:/Aspose/Net/Assembly/Aspose.PDF.dll">
上述标签中的class属性指向Aspose.PDF Facades类,在本例中是PdfFileInfo。name属性是类的实例名称,稍后将在代码中用于访问类的方法或属性。type属性指定组件的类型 - 在我们的例子中是.NET。
在Coldfusion中使用.NET组件时,您必须记住一个重要的点,即当您获取或设置类对象的任何属性时,必须遵循特定的结构。要设置属性,您将使用类似Set_propertyname的语法,而要获取属性值,您将使用Get_propertyname。
例如,设置属性值:
<cfset FilePath = ExpandPath("guide.pdf")>
获取属性值:
<cfoutput>#fileinfo.Get_title()#</cfoutput>
下面是一个基本但完整的示例,帮助您理解在Coldfusion中使用Aspose.PDF for .NET的过程。
<!--- create an instance of PdfFileInfo class --->
<cfobject type = ".NET" name = "fileinfo" class = "Aspose.Pdf.Facades.PdfFileInfo"
assembly = "C:/Aspose/Net/Assembly/Aspose.PDF.dll">
<!--- get pdf file path --->
<cfset FilePath = ExpandPath("guide.pdf")>
<!--- assign pdf file path to the class object by setting its inputfile property--->
<cfset fileinfo.Set_inputfile(FilePath)>
<!--- Show file info --->
<cfoutput><b>Title:</b>#fileinfo.Get_title()#</cfoutput><br/>
<cfoutput><b>Subject:</b>#fileinfo.Get_subject()#</cfoutput><br/>
<cfoutput><b>Author:</b>#fileinfo.Get_author()#</cfoutput><br/>
<cfoutput><b>Creator:</b>#fileinfo.Get_Creator()#</cfoutput><br/>
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.