Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
PDF Creator Pilot 3 Knowledge Base
How to Create a PDF with ASP.NET on a Web Server without Visual Studio

See Also Example
Collapse All

To enable PDF Creator Pilot to work with ASP.NET, you must perform three steps:

  1. Create an Interop-wrapper
  2. Copy the wrapper into a specific folder
  3. Attach the namespace libraries to the application

To create the Interop wrapper of PDF Creator Pilot (i.e. a wrapper that would make it possible to call the unmanaged COM object code of the library from the managed code of an ASP.NET application), use one of the standard utilities from the .NET SDK - TlbImp.exe (C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\TlbImp.exe)

Example:

TlbImp.exe PDFCreatorPilot.dll /out:Interop.PDFCreatorPilotLib.dll

Then copy the wrapper into the "bin" subfolder of the Web application root folder. (If that folder does not yet exist, we will have to create it.)

Example:

If the Web application is located in "C:\Inetpub\wwwroot\MyApp", then put the wrapper into "C:\Inetpub\wwwroot\MyApp\bin".

To attach the Web application to the namespace library, append the following line to the ".aspx"-file:

<%@ Import Namespace="Interop.PDFCreatorPilotLib" %>

After that, a COM-object of PDF Creator Pilot may be used from ASP.NET.

Example

Using PDF Creator Pilot in ASP.NET page

C#
[copy to clipboard]
<%@ Import Namespace="System" %>
<!-- other import directives are here -->
<%@ Import Namespace="Interop.PDFCreatorPilotLib" %>
<HTML> <HEAD>
  <TITLE>Test</TITLE>
  <SCRIPT language="C#" runat="server">
    void ButtonPerform_Click(object sender, System.EventArgs e)
    {
      PDFDocument3Class pdf = new PDFDocument3Class();
      pdf.StartEngine("demo@demo", "demo");
      pdf.AutoCreateURL = true;
      // set other options if needed
      pdf.BeginDoc();
      // do something
      pdf.EndDoc();
    }
  </SCRIPT>
</HEAD>
<BODY>
  <!-- here page content goes -->
  <FORM runat="server">
    <INPUT type="button" id="ButtonPerform" value="Click Me"
      OnServerClick="ButtonPerform_Click" runat="server" />
    <!-- or another vaiant -->
    <asp:Button id="ButtonPerform1" Text="Click Me"
      OnClick="ButtonPerform_Click" runat="server" />
  </FORM>
</BODY>
</HTML>

See Also

Reference

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots