RapiPDF
Attributes   |   Methods   |   Localization

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)
pdf-schema-style style to display request and response schemas
can be 'table' or 'object'
object
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
include-example true to include OpenAPI-specified examples 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>