Configure PDF Web API Service
In This Topic
C1 Web API PDFDocument Services enable you to build HTTP services, which can be consumed by a variety of clients for viewing, loading and caching PDF files. These are REST based API services, which communicate with the HTML 5 PDFViewer control to display the pdf file content on the web.
Complete the following steps to setup PDF services.
Step1: Create a new WebAPI application
- In Visual Studio, select File | New | Project to create a new Web API Service Project.
- Under installed templates, select Visual C# | Web | C1 Web API Application to create a new C1 Web API Service application.
- Set a Name and Location for your application, and then Click OK.
- In the ComponentOne ASP.NET Web API Application Wizard, select Pdf services option.
- Once you have selected the Services from the wizard, click OK to create a new C1 Web API Service application.
Configure Startup.cs file
- Create a folder named PdfRoot, in your service application.
- Add the desired PDF files to this folder.
- From the Solution Explorer, select and open Startup.cs file.
- In the Startup.cs file, add disk storage in Configure method of Startup.
Startup.cs |
Copy Code
|
app.UseStorageProviders()
.AddDiskStorage ("PdfRoot", System.IO.Path.Combine(System.Web.HttpRuntime.AppDomainAppPath, "PdfRoot"));
|
Step 3: Build and Run the Project
- Click Build | Build Solution to build the project.
- Press F5 to run the project.
Back to Top