<rapi-pdf>

# Web Component to generate PDF from OpenAPI Spec

Create beautiful, customizable API documentation in PDF format from your OpenAPI Specification

Web Component Standard
Free of any frameworks, setups, configs, build steps or packaging. Can be used with any framework or just with vanilla javascript
Easy Usage
Use It just like any other HTML Tag, use its various attributes to customize the generation of your PDF. Basic knowledge of HTML is all that's required
Customizable
Change font colors to match your brand colors. Pick and choose the sections from the API Spec that you want to include in the PDF.
Seamlessly interoperable
Loved by tech writers, designers, dev-ops, testers and developers alike, due to its simplicity, interoperability and powerful features.

## Quickstart & Demo

Just copy the below code and save it in an html file. Then open it using a browser

      <!doctype html>
      <html>
      <head>
        <script src="https://unpkg.com/rapipdf/dist/rapipdf-min.js"></script>
      </head>
      <body>
        <rapi-pdf
          style = "width:700px; height:40px; font-size:18px;"
          spec-url = "https://mrin9.github.io/RapiPdf/examples/specs/petstore.json"
          button-bg = "#b44646"
        > </rapi-pdf>
      </body>
      </html>

Go ahead, provide your Open API spec and click GENERATE PDF !!!

## Attributes

Attribute | Description | Default
--- | --- | ---
spec-url | url of the OpenAPI spec to view | (empty)
button-label | Label on the Button | GENERATE PDF
button-bg | Background color for the button | #0078d7
button-color | Text color on the button | white
input-bg | Background color for text input | white
input-color | Text color of the input box | #333
hide-input | true to hide input Text box | false
pdf-primary-color | Color used for headings of main sections in PDF | #b44646
pdf-alternate-color | Color used for sub headings | #005b96
pdf-title | Title of the generated PDF | API Reference
pdf-footer-text | Text to be printed at the bottom of every page | (empty)
include-info | true to include info section in the generated PDF | true
include-toc | true to include table-of-contents in the generated PDF | true
include-security | true to include security section in the generated PDF | true
include-api-details | true to include all the API details in the generated PDF | true
include-api-list | true to include list of all the APIs and their summary at the end in the generated PDF | false

## Methods

Name | Description
--- | ---
generatePdf(spec) | to programmatically generate the PDF. Takes a single parameter that can be : either a string containing the url of the specs or a JSON object representing a valid spec Example
setAttribute(attr-name, value) | All HTML elements contains setAttribute() method, You may use this method to programmatically update/change any of its properties

## Localization

create a <template> inside <rapi-pdf> element and provide the translations

    <rapi-pdf spec-url="https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json">
      <template>
      {
        "index"          : "INDEX",
        "api"            : "API",
        "apiList"        : "API List",
        "apiReference"   : "API Reference",
        "apiVersion"     : "API Version",
        "contact"        : "CONTACT",
        "name"           : "NAME",
        "email"          : "EMAIL",
        "url"            : "URL",
        "termsOfService" : "Terms of service",
        "securitySchemes": "SECURITY SCHEMES",
        "type"           : "TYPE",
        "description"    : "DESCRIPTION",
        "request"        : "REQUEST",
        "requestBody"    : "REQUEST BODY",
        "response"       : "RESPONSE",
        "responseModel"  : "RESPONSE MODEL",
        "statusCode"     : "STATUS CODE",
        "deprecated"     : "DEPRECATED",
        "allowed"        : "allowed",
        "pattern"        : "pattern",
        "parameters"     : "Parameters",
        "method"         : "METHOD",
        "securityAndAuthentication" : "Security and Authentication",
        "noRequestParameters"       : "No request parameters",
      }
      </template>
    </rapi-pdf>