We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to create PDF from a Windows service?

To create PDF from a Windows service:

  1. In the Visual Studio, choose File->New->Project.
  2. In the list of Visual C# project templates, choose Windows Service and name the Project, for example, MyPdfService, and then click ok.
  3. In the solution explorer, rename the service1.cs to PdfService.cs.
  4. PdfService.cs contains two default functions, OnStart() and OnStop(). Write the appropriate codes for these two functions. The following code example shows how to merge a PDF document in the Windows Services.

C#

  1. In the solution explorer, right click the PdfService.cs and choose View Designer. Now, the designer window is opened.
  2. Right Click the Designer window and choose AddInstaller. By default, a component class that contains two installers is added to your project. The component’s name is ProjectInstaller.
  3. In the design view of the ProjectInstaller, choose serviceInstaller1 in the property window, and set the ServiceName as PdfService.
  4. In the design view of the ProjectInstaller, choose ServiceProcessInstaller1. In the property window, set the Account property as LocalSystem.

 

Installing the service:

  1. Run the Visual Studio Developer Command Prompt as the Administrator.
  2. In the command Prompt window, navigate the folder that contains your project bin file. For example, visual studio 2012\Projects\MyPdfService\bin\Debug.
  3. Then enter the following command: installutil.exe MyPdfService.exe

Now, the service is installed successfully.

 

Start the Service:

  1. Open administrative tools and choose services. You should see PdfService in the services window.
  2. In the services window, right click the PdfService and select start. Now, the Windows Service is started.

 

Uninstalling the service:

Enter the following command for the Visual Studio Developer Command Prompt: installutil.exe /u MyPdfService.exe

Now, the service is uninstalled.

 

Sample Link:

http://www.syncfusion.com/downloads/support/directtrac/general/MyPdfService-644014439.zip

Article ID: Published Date: Last Revised Date: Platform: Control:
4968 05/23/2015 05/23/2015 Windows Forms PDF
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.