Wednesday, February 6, 2019

Export swagger api document to pdf in Swagger UI

In this blog, we will discuss how to generate or export Swagger API documentation into PDF file. Recently I faced this challenge, when we needed to share API documentation information with external client and due to security and other reason we can’t expose production Swagger API URL to client and then we decided to go with PDF document which should have API information like API URL, input parameter, output model and HTTP verbs – GET/PUT/POST.

This blog will demonstrates steps to generate PDF document from Swagger UI/JSON data by using third party component (swagger-spec-to-pdf)

Here is swagger API URL


 
Swagger API 

In above image, you can see swagger document URL:  http://localhost:27860/swagger/docs/v1



  •  Install swagger-spec-to-pdf package by using npm
           Syntax:  
           npm install -g swagger-spec-to-pdf

  • Open the Command Prompt  and run the below command (swagger2pdf ) to generate PDF


  •  Generates api.pdf file


Generated api.pdf document:


Other swagger related posts

3 comments:

Grey Bara said...

You can always try www.zetpdf.com to sort out this problem.

zaheershk said...

Hi Rajeev
I've been trying this, but it doesnt seem to be working. I posted an issue on the github account of the npm utility (https://github.com/agreatfool/swagger-spec-to-pdf/issues/16), but also wanted to check if you have any suggestions on what could be the problem?

Peter Floyd said...

To export Swagger API documentation to PDF in Swagger UI, navigate to the desired endpoint, click "Export", select "PDF", and save the generated document. I recommend to use ZetPDF . Thanks

SQL Server - Identify unused indexes

 In this blog, we learn about the index usage information (SYS.DM_DB_INDEX_USAGE_STATS) and analyze the index usage data (USER_SEEKS, USER_S...