@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api PdfBroker.io API
@version v1
@auth OAuth2
@endpoints 16
@toc api(16)

@endpoint GET /api/pdf
@desc Basic method to verify api is up and running
@optional {X-Api-Version: str}
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}

@endpoint GET /api/v1/pdf
@desc Basic method to verify api is up and running
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}

@endpoint POST /api/pdf/xslfo
@desc Create pdf-file from complete XSL-FO document.
@optional {X-Api-Version: str, foDocumentBase64String: str # This is the complete XSL-FO document provided using Base64 encoding., resources: map # This is a set of key-value pairs of digital resources like images that is referenced in the XSL-FO document. It uses the filename as key and the data is provided as a Base64 encoded string., metadata: map{title: str, author: str, subject: str, keywords: [str], enableAdd: bool, enableCopy: bool, enableModify: bool, enablePrinting: bool, ownerPassword: str, userPassword: str} # Enter meta data for pdf document}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"foDocumentBase64String":"<Encode your XSL-FO document as Base64 encoded string>","resources":{"<Use file name as key, i.e 'logo.png', which is set as src on fo:external-graphic elements>":"<Convert your images to Base64 encoded string>"},"metadata":{"title":"Pdf title metadata can be set with metadata object","author":null,"subject":null,"keywords":["pdf","api"],"enableAdd":true,"enableCopy":true,"enableModify":true,"enablePrinting":true,"ownerPassword":null,"userPassword":null}}

@endpoint POST /api/v1/pdf/xslfo
@desc Create pdf-file from complete XSL-FO document.
@optional {foDocumentBase64String: str # This is the complete XSL-FO document provided using Base64 encoding., resources: map # This is a set of key-value pairs of digital resources like images that is referenced in the XSL-FO document. It uses the filename as key and the data is provided as a Base64 encoded string., metadata: map{title: str, author: str, subject: str, keywords: [str], enableAdd: bool, enableCopy: bool, enableModify: bool, enablePrinting: bool, ownerPassword: str, userPassword: str} # Enter meta data for pdf document}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"foDocumentBase64String":"<Encode your XSL-FO document as Base64 encoded string>","resources":{"<Use file name as key, i.e 'logo.png', which is set as src on fo:external-graphic elements>":"<Convert your images to Base64 encoded string>"},"metadata":{"title":"Pdf title metadata can be set with metadata object","author":null,"subject":null,"keywords":["pdf","api"],"enableAdd":true,"enableCopy":true,"enableModify":true,"enablePrinting":true,"ownerPassword":null,"userPassword":null}}

@endpoint POST /api/pdf/xslfowithtransform
@desc Create pdf-file from transforming xml document with Xsl-Fo transform document.
@optional {X-Api-Version: str, foDocumentBase64String: str # This is the complete XSL-FO document provided using Base64 encoding., resources: map # This is a set of key-value pairs of digital resources like images that is referenced in the XSL-FO document. It uses the filename as key and the data is provided as a Base64 encoded string., metadata: map{title: str, author: str, subject: str, keywords: [str], enableAdd: bool, enableCopy: bool, enableModify: bool, enablePrinting: bool, ownerPassword: str, userPassword: str} # Enter meta data for pdf document, xmlDataDocumentBase64String: str # This is xml data document on which the XSL-FO transform document is applied. Provided using Base64 encoding.}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"xmlDataDocumentBase64String":"<This is the document which contains your data that the XSL-FO transform will be applied on. Send as Base64 encoded string>","foDocumentBase64String":"<Encode your XSL-FO transform document as Base64 encoded string>","resources":{"<Use file name as key, i.e 'logo.png', which is set as src on fo:external-graphic elements>":"<Convert your images to Base64 encoded string>"},"metadata":null}

@endpoint POST /api/v1/pdf/xslfowithtransform
@desc Create pdf-file from transforming xml document with Xsl-Fo transform document.
@optional {foDocumentBase64String: str # This is the complete XSL-FO document provided using Base64 encoding., resources: map # This is a set of key-value pairs of digital resources like images that is referenced in the XSL-FO document. It uses the filename as key and the data is provided as a Base64 encoded string., metadata: map{title: str, author: str, subject: str, keywords: [str], enableAdd: bool, enableCopy: bool, enableModify: bool, enablePrinting: bool, ownerPassword: str, userPassword: str} # Enter meta data for pdf document, xmlDataDocumentBase64String: str # This is xml data document on which the XSL-FO transform document is applied. Provided using Base64 encoding.}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"xmlDataDocumentBase64String":"<This is the document which contains your data that the XSL-FO transform will be applied on. Send as Base64 encoded string>","foDocumentBase64String":"<Encode your XSL-FO transform document as Base64 encoded string>","resources":{"<Use file name as key, i.e 'logo.png', which is set as src on fo:external-graphic elements>":"<Convert your images to Base64 encoded string>"},"metadata":null}

@endpoint POST /api/pdf/pdftoimage
@desc Generate an image of to provided pdf file
@optional {X-Api-Version: str, pdfFileBase64String: str # The pdf file to generate image from, as Base64 encoded string., options: map{pageNumber: int(int32), imageFormat: str, horizontalResolution: num(double), verticalResolution: num(double), width: int(int32), height: int(int32), transparent: bool, jpegQuality: int(int32), pngCompressionLevel: int(int32)}}
@returns(200) {errorMessage: str?, imageBase64String: str?} # Generate an image of the provided pdf file. Either the image file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"pdfFileBase64String":"<Encode your existing PDF document as Base64 encoded string>","options":{"pageNumber":1,"imageFormat":"image/jpeg","horizontalResolution":96,"verticalResolution":96,"width":0,"height":0,"transparent":false,"jpegQuality":90,"pngCompressionLevel":6}}

@endpoint POST /api/v1/pdf/pdftoimage
@desc Generate an image of to provided pdf file
@optional {pdfFileBase64String: str # The pdf file to generate image from, as Base64 encoded string., options: map{pageNumber: int(int32), imageFormat: str, horizontalResolution: num(double), verticalResolution: num(double), width: int(int32), height: int(int32), transparent: bool, jpegQuality: int(int32), pngCompressionLevel: int(int32)}}
@returns(200) {errorMessage: str?, imageBase64String: str?} # Generate an image of the provided pdf file. Either the image file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"pdfFileBase64String":"<Encode your existing PDF document as Base64 encoded string>","options":{"pageNumber":1,"imageFormat":"image/jpeg","horizontalResolution":96,"verticalResolution":96,"width":0,"height":0,"transparent":false,"jpegQuality":90,"pngCompressionLevel":6}}

@endpoint POST /api/pdf/pdfconcat
@desc Concatenate multiple pdf files into single pdf file..
@optional {X-Api-Version: str, pdfDocumentsAsBase64String: [str] # The list of Pdf documents encoded as Base64 strings.}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"pdfDocumentsAsBase64String":["<Encode your pdf documents as Base64 encoded string>","<Encode your pdf documents as Base64 encoded string>"]}

@endpoint POST /api/v1/pdf/pdfconcat
@desc Concatenate multiple pdf files into single pdf file..
@optional {pdfDocumentsAsBase64String: [str] # The list of Pdf documents encoded as Base64 strings.}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"pdfDocumentsAsBase64String":["<Encode your pdf documents as Base64 encoded string>","<Encode your pdf documents as Base64 encoded string>"]}

@endpoint POST /api/pdf/pdfwritestring
@desc Write text on a page in a pdf document.
@optional {X-Api-Version: str, pdfFileBase64String: str # The pdf file to add text to, as Base64 encoded string., options: map{text: str, textColor: map, font: map, pageNumber: int(int32), xPosition: num(float), yPosition: num(float), xOrigin: int(int32), yOrigin: int(int32)} # Options for writing string in pdf page;, fontFileBase64String: str # System fonts are available, but you can provide your own font file to be embedded in the pdf document. Send font as Base64 encoded string.}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"pdfFileBase64String":"<Encode your existing PDF document as Base64 encoded string>","options":{"text":"This is test string","textColor":{"r":33,"g":34,"b":35},"font":{"name":"Arial","size":24,"style":1},"pageNumber":3,"xPosition":40,"yPosition":-200,"xOrigin":1,"yOrigin":2},"fontFileBase64String":"<Attach your own TrueTypeFont file if necessary to style text, encoded as Base64 encoded string>"}

@endpoint POST /api/v1/pdf/pdfwritestring
@desc Write text on a page in a pdf document.
@optional {pdfFileBase64String: str # The pdf file to add text to, as Base64 encoded string., options: map{text: str, textColor: map, font: map, pageNumber: int(int32), xPosition: num(float), yPosition: num(float), xOrigin: int(int32), yOrigin: int(int32)} # Options for writing string in pdf page;, fontFileBase64String: str # System fonts are available, but you can provide your own font file to be embedded in the pdf document. Send font as Base64 encoded string.}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs parsing input, 415: If content-type of request is not set to multipart/form-data or application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"pdfFileBase64String":"<Encode your existing PDF document as Base64 encoded string>","options":{"text":"This is test string","textColor":{"r":33,"g":34,"b":35},"font":{"name":"Arial","size":24,"style":1},"pageNumber":3,"xPosition":40,"yPosition":-200,"xOrigin":1,"yOrigin":2},"fontFileBase64String":"<Attach your own TrueTypeFont file if necessary to style text, encoded as Base64 encoded string>"}

@endpoint POST /api/pdf/weasyprint
@desc Generate pdf file from html/url using Weasyprint. Requires paid subscription. This is our premium pdf generator. It is the most accurate and feature rich pdf generator we have with support for pdf/a-1b, pdf/a-2b, pdf/a-3b, pdf/a-4b and pdf/ua-1.
@optional {X-Api-Version: str, url: str # The url to generate pdf from. Url has precedence over HtmlBase64String value if both are set., htmlBase64String: str # Base64 encoded string with html. If property Url is set, it will be used, not HtmlBase64String., resources: map # This is a set of key-value pairs of digital resources like images that is referenced in the HtmlBase64String document. It uses the filename including relative path as key and the data is provided as a Base64 encoded string., weasyPrintToPdfArguments: map # Command line arguments passed to Weasyprint. Invalid arguments will be ignored. Invalid arguments are "v", "verbose", "version", "d", "debug", "q", "quiet", "h", "help", "u", "f", "format".}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs executing request, 415: If content-type of request is not set to application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"weasyPrintToPdfArguments":{"pdf-variant":"pdf/ua-1"},"url":"https://www.pdfbroker.io","htmlBase64String":null,"resources":null}

@endpoint POST /api/v1/pdf/weasyprint
@desc Generate pdf file from html/url using Weasyprint. Requires paid subscription. This is our premium pdf generator. It is the most accurate and feature rich pdf generator we have with support for pdf/a-1b, pdf/a-2b, pdf/a-3b, pdf/a-4b and pdf/ua-1.
@optional {url: str # The url to generate pdf from. Url has precedence over HtmlBase64String value if both are set., htmlBase64String: str # Base64 encoded string with html. If property Url is set, it will be used, not HtmlBase64String., resources: map # This is a set of key-value pairs of digital resources like images that is referenced in the HtmlBase64String document. It uses the filename including relative path as key and the data is provided as a Base64 encoded string., weasyPrintToPdfArguments: map # Command line arguments passed to Weasyprint. Invalid arguments will be ignored. Invalid arguments are "v", "verbose", "version", "d", "debug", "q", "quiet", "h", "help", "u", "f", "format".}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs executing request, 415: If content-type of request is not set to application/json, 429: If you reach the monthly request limit for your subscription plan}
@example_request {"weasyPrintToPdfArguments":{"pdf-variant":"pdf/ua-1"},"url":"https://www.pdfbroker.io","htmlBase64String":null,"resources":null}

@endpoint POST /api/pdf/wkhtmltopdf
@desc Generate pdf file from url using the excellent tool wkhtmltopdf.
@optional {X-Api-Version: str, url: str # The url to generate pdf from. Url has precedence over HtmlBase64String value if both are set., htmlBase64String: str # Base64 encoded string with html. If property Url is set, it will be used, not HtmlBase64String., resources: map # This is a set of key-value pairs of digital resources like images that is referenced in the HtmlBase64String document. It uses the filename including relative path as key and the data is provided as a Base64 encoded string., wkHtmlToPdfArguments: map # Command line arguments passed to wkhtmltopdf. Invalid arguments will be ignored. Invalid arguments are "manpage", "help", "H", "h", "extended-help", "htmldoc", "readme", "license", "read-args-from-stdin", "readme", "version", "V", "debug-javascript", "no-debug-javascript", "enable-local-file-access", "disable-local-file-access", "allow".}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs executing request, 415: If content-type of request is not set to application/json, 429: If you reach the monthly request limit for your subscription plan, 503: If the service is temporarily unavailable due to high load}
@example_request {"wkHtmlToPdfArguments":{"grayscale":"","viewport-size":"1280x1024"},"url":"https://www.pdfbroker.io","htmlBase64String":null,"resources":null}

@endpoint POST /api/v1/pdf/wkhtmltopdf
@desc Generate pdf file from url using the excellent tool wkhtmltopdf.
@optional {url: str # The url to generate pdf from. Url has precedence over HtmlBase64String value if both are set., htmlBase64String: str # Base64 encoded string with html. If property Url is set, it will be used, not HtmlBase64String., resources: map # This is a set of key-value pairs of digital resources like images that is referenced in the HtmlBase64String document. It uses the filename including relative path as key and the data is provided as a Base64 encoded string., wkHtmlToPdfArguments: map # Command line arguments passed to wkhtmltopdf. Invalid arguments will be ignored. Invalid arguments are "manpage", "help", "H", "h", "extended-help", "htmldoc", "readme", "license", "read-args-from-stdin", "readme", "version", "V", "debug-javascript", "no-debug-javascript", "enable-local-file-access", "disable-local-file-access", "allow".}
@returns(200) {errorMessage: str?, pdfFileBase64String: str?} # Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
@errors {400: If any error occurs executing request, 415: If content-type of request is not set to application/json, 429: If you reach the monthly request limit for your subscription plan, 503: If the service is temporarily unavailable due to high load}
@example_request {"wkHtmlToPdfArguments":{"grayscale":"","viewport-size":"1280x1024"},"url":"https://www.pdfbroker.io","htmlBase64String":null,"resources":null}

@end
