How to create PDF by using WEBAPI(Get call) response in C#

Could you please share/suggest code sample for create pdf by using web api get response in C#.

Thanks

@SAIKUMAR271

Do you want to build/create your own web API and use Aspose.PDF in the code behind by referencing it? OR you want to use a Cloud service like Aspose.PDF Cloud to serve the purpose? You can create a post in Aspose.PDF Cloud forum in case you are interested in using it. Please let us know in case you want to implement Aspose.PDF for .NET in code behind of an application. We will share our feedback with you accordingly.

Thanks for the quick response.

I have developed web API project(have all GET calls only), current response is XML. I am directly communicating with oracle database and getting results with the GET call. My requirement is to add that response into PDF as table in .NET.
Please share/help that how to implement Aspose.PDF in API Controller or in other class in the application to create and save the PDF.

Thanks

@SAIKUMAR271

You can simply add a reference to Aspose.PDF for .NET in your solution by using NuGet Package Manager and use the API to create a PDF document with a table inside it. Please check the public API documentation which offers in-depth knowledge of API installation and code sample. You can check the below article to add a table inside PDF:

Thanks.

I am able to create the table with the static data by using Aspose.PDF.

With help of
Convert XML to PDF | C# | Documentation (aspose.com)

  1. Create a Hello World PDF Document through XML and XSLT

We can create PDF by using XML file right?
If so can we have chance to covert XML to XSLT by using Aspose.PDF or any Aspose related techniques to do same. Please suggest.

@SAIKUMAR271

Yes, you can create PDF from XML template using Aspose.PDF as you have already seen the related article in the documentation. However, the XML formatting and sequence elements should be according to XML Schema supported by the API.

We are afraid that there is no API offered by Aspose that converts an XML to XSLT. You need to generate your own XML with XSLT styles by following the XML schema and export to PDF. Please let us know in case you need further information.

Thanks a lot