pdfbroker
Module pdfbroker
API
Definitions
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_pdfbroker_1.5.1.png)
ballerinax/pdfbroker Ballerina library
Overview
This is a generated connector for PDFBroker API v1.0.0 OpenAPI Specification.
PdfBroker.io is an api for creating pdf files from Xsl-Fo or Html and other useful pdf utilities.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a PDFBroker account Account
- Obtaining tokens
- Obtain your token by following this link
Clients![](/images/permalink.svg)
pdfbroker: Client![](/images/permalink.svg)
This is a generated connector from PdfBroker.io API v1 OpenAPI Specification. PdfBroker.io is an api for creating pdf files from Xsl-Fo or Html and other useful pdf utilities.
Constructor![](/images/permalink.svg)
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create an PdfBroker account and obtain tokens following this guide.
init (ConnectionConfig config, string serviceUrl)
- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string - URL of the target service
verfiyAPIStatus![](/images/permalink.svg)
Basic method to verify api is up and running
createPDfFromXSLFO![](/images/permalink.svg)
function createPDfFromXSLFO(FoRequestDto payload) returns PdfResponseDto|error
Create pdf-file from complete XSL-FO document.
Parameters
- payload FoRequestDto - XSL-FO Request, the basic XSL-FO request. Post your XSL-FO document and digital resources, either as 'multipart/form-data' or 'application/json'
Return Type
- PdfResponseDto|error - Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
createPDFfromXML![](/images/permalink.svg)
function createPDFfromXML(FoTransformRequestDto payload) returns PdfResponseDto|error
Create pdf-file from transforming xml document with Xsl-Fo transform document.
Parameters
- payload FoTransformRequestDto - XSL-FO Transform Request. The XSL-FO is transformed on the supplied xml data document. Post your XSL-FO transform document and xml data document aloing with your digital resources, either as 'multipart/form-data' or 'application/json'
Return Type
- PdfResponseDto|error - Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
createPDFfromImage![](/images/permalink.svg)
function createPDFfromImage(PdfToImageRequestDto payload) returns ImageResponseDto|error
Generate an image of to provided pdf file
Parameters
- payload PdfToImageRequestDto - PdfToImage Request. Create an image of a page in an existing pdf document.
Return Type
- ImageResponseDto|error - 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
concatenatePDFs![](/images/permalink.svg)
function concatenatePDFs(PdfConcatenationRequestDto payload) returns PdfResponseDto|error
Concatenate multiple pdf files into single pdf file..
Parameters
- payload PdfConcatenationRequestDto - PdfConcat Request. Add two or more pdf files and concatenate pages into single pdf document.
Return Type
- PdfResponseDto|error - Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
addTextonPDFPage![](/images/permalink.svg)
function addTextonPDFPage(PdfWriteStringRequestDto payload) returns PdfResponseDto|error
Write text on a page in a pdf document.
Parameters
- payload PdfWriteStringRequestDto - PdfWriteString Request. Write string on page in pdf document
Return Type
- PdfResponseDto|error - Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
generatePDFfromURL![](/images/permalink.svg)
function generatePDFfromURL(WkHtmlToPdfRequestDto payload) returns PdfResponseDto|error
Generate pdf file from url using the excellent tool wkhtmltopdf.
Parameters
- payload WkHtmlToPdfRequestDto - WkHtmlToPdf Request. Generate pdf from html, either from url or base64 encoded html string
Return Type
- PdfResponseDto|error - Returns the newly created pdf file. Either the file directly or serialized as Json if Accept-header is set to application/json
Records![](/images/permalink.svg)
pdfbroker: ClientHttp1Settings![](/images/permalink.svg)
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
pdfbroker: ColorDto![](/images/permalink.svg)
Set color
Fields
- R int? - Get or sets R value of RGB color
- G int? - Get or sets G value of RGB color
- B int? - Get or sets B value of RGB color
pdfbroker: ConnectionConfig![](/images/permalink.svg)
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth OAuth2ClientCredentialsGrantConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
pdfbroker: ErrorResponseDto![](/images/permalink.svg)
Fields
- ErrorMessage string? - If any error occurs the message will be displayed in here
- Description string? -
- StatusCode int? -
pdfbroker: FontDto![](/images/permalink.svg)
The Font dto object
Fields
- Name string? - Gets the name of the font
- Size float? - Gets the size of the font
- Style FontStyle? - Font style enum representing Regular, Bold, Italic, BoldItalic
pdfbroker: FoRequestDto![](/images/permalink.svg)
The basic request with the XSL-FO document as a Base64 encoded string with a set of resources provided with a name and the data of the resource as a Base64 encoded string.
Fields
- FoDocumentBase64String string? - This is the complete XSL-FO document provided using Base64 encoding.
- Resources record {}? - 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 PdfMetadataDto? - Enter meta data for pdf document
pdfbroker: FoTransformRequestDto![](/images/permalink.svg)
The XSL-FO transform document and xml data document as a Base64 encoded string with a set of resources provided with a name and the data of the resource as a Base64 encoded string.
Fields
- FoDocumentBase64String string? - This is the complete XSL-FO document provided using Base64 encoding.
- Resources record {}? - 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 PdfMetadataDto? - Enter meta data for pdf document
- XmlDataDocumentBase64String string? - This is xml data document on which the XSL-FO transform document is applied. Provided using Base64 encoding.
pdfbroker: ImageResponseDto![](/images/permalink.svg)
When setting the Accept-header in the request to "application/json" the image file will be return as Base64 encoded string. Note that converting data to Base64 encoded strings increases the response size with approximately 33%, if you can accept the a binary format it's better to use Accept-header "image/jpeg", "image/png" or "image/gif".
Fields
- ErrorMessage string? - If any error occurs the message will be displayed in here
- ImageBase64String string? - The Base64 encoded string that is the image file. This is a complete data uri, including media type that can be used directly as src on a img-tag e.g.
pdfbroker: OAuth2ClientCredentialsGrantConfig![](/images/permalink.svg)
OAuth2 Client Credentials Grant Configs
Fields
- Fields Included from *OAuth2ClientCredentialsGrantConfig
- tokenUrl string(default "https://login.pdfbroker.io/connect/token") - Token URL
pdfbroker: PdfConcatenationRequestDto![](/images/permalink.svg)
Request to concatenate a list of Pdf documents to a single Pdf document.
Fields
- PdfDocumentsAsBase64String string[]? - The list of Pdf documents encoded as Base64 strings.
pdfbroker: PdfMetadataDto![](/images/permalink.svg)
Enter meta data for pdf document
Fields
- Title string? - Pdf document title
- Author string? - Pdf document author
- Subject string? - Pdf document subject
- Keywords string[]? - Pdf document keywords
- EnableAdd boolean? - Enables or disables adding or modifying text annotations and interactive form fields.
- EnableCopy boolean? - Enables or disables copying of text and graphics.
- EnableModify boolean? - Enables or disables modifying document contents (other than text annotations and interactive form fields).
- EnablePrinting boolean? - Enables or disables printing.
- OwnerPassword string? - Specifies the owner password that will protect full access to any generated PDF documents.
- UserPassword string? - Specifies the user password that will protect access to any generated PDF documents.
pdfbroker: PdfPdfconcatBody![](/images/permalink.svg)
Fields
- pdfdocument1 string? - Add pdf files to be concatenated into single file
- pdfdocument2 string? - You can add more than two files in the same request
pdfbroker: PdfPdftoimageBody![](/images/permalink.svg)
Fields
- pdfdocument string? - An entry named pdfdocument is required in the multipart/form-data request
- options string? - After pdfdocument is added, add an entry named options with your PdfToImageOptions object serialized as JSON.
pdfbroker: PdfPdfwritestringBody![](/images/permalink.svg)
Fields
- pdfdocument string? - An entry named pdfdocument is required in the multipart/form-data request
- options string? - After pdfdocument is added, add an entry named options with your PdfWriteStringOptions object serialized as JSON.
- fontfile string? - Optional entry to attach your own TrueType font file to style string
pdfbroker: PdfResponseDto![](/images/permalink.svg)
When setting the Accept-header in the request to "application/json" the content of the pdf file will be return as Base64 encoded string. Note that converting data to Base64 encoded strings increases the response size with approximately 33%, if you can accept the a binary format it's better to use Accept-header "application/pdf".
Fields
- ErrorMessage string? - If any error occurs the message will be displayed in here
- PdfFileBase64String string? - The Base64 encoded string that is the pdf file.
pdfbroker: PdfToImageOptions![](/images/permalink.svg)
Fields
- PageNumber int? - Which page of the pdf file to generate image from, default is first page
- ImageFormat string? - Valid options are "image/jpeg", "image/png" or "image/gif". Default is "image/png"
- HorizontalResolution decimal? - Set the horizontal resolution, default is 96 dpi;
- VerticalResolution decimal? - Set the vertical resolution, default is 96 dpi;
- Width int? - Set the width of the output image, default value is width of source document. To scale width, and keeping proportions, do not set height;
- Height int? - Set the height of the output image, default value is width of source document. To scale height, and keeping proportions, do not set width;
- Transparent boolean? - Keep the background of the image transparent. This setting is not available in JPEG-files, since transparency is not supported in the JPEG format.
- JpegQuality int? - Sets the quality of jpeg images, range 0 to 100, default is 75
- PngCompressionLevel int? - Sets the png compression level, range 1 - 9, default is 6
pdfbroker: PdfToImageRequestDto![](/images/permalink.svg)
Fields
- PdfFileBase64String string? - The pdf file to generate image from, as Base64 encoded string.
- Options PdfToImageOptions? -
pdfbroker: PdfWriteStringOptions![](/images/permalink.svg)
Options for writing string in pdf page;
Fields
- Text string? - The text to write in the pdf
- TextColor ColorDto? - Set color
- Font FontDto? - The Font dto object
- PageNumber int? - Get or set which page in the pdf to write on, default is first page.
- XPosition float? - Get or set the X axis position on where to write string, in reference to XOrigin.
- YPosition float? - Get or set the Y axis position on where to write string, in reference to YOrigin.
- XOrigin XOriginPoint? - XOriginPoint
- YOrigin YOriginPoint? - YOriginPoint
pdfbroker: PdfWriteStringRequestDto![](/images/permalink.svg)
The request dto object to write a string on pdf page
Fields
- PdfFileBase64String string? - The pdf file to add text to, as Base64 encoded string.
- Options PdfWriteStringOptions? - Options for writing string in pdf page;
- FontFileBase64String string? - 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.
pdfbroker: PdfXslfoBody![](/images/permalink.svg)
Fields
- fodocument string? - An entry named fodocument is required in the multipart/form-data request
- resources string? - After fodocument is added, add all digital resources one by one to your multipart/form-data request, using the filename as name in the form.
- metadata string? - Add pdf document metadata like title, author, subject and keywords
pdfbroker: PdfXslfowithtransformBody![](/images/permalink.svg)
Fields
- fodocument string? - An entry named fodocument with your XSL-FO transform is required in the multipart/form-data request
- xmldatadocument string? - An entry named xmldatadocument, on which the XSL-FO transform is applied, is required in the multipart/form-data request
- resources string? - After fodocument and xmldatadocument is added, add all digital resources one by one to your multipart/form-data request, using the filename as name in the form.
pdfbroker: ProxyConfig![](/images/permalink.svg)
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
pdfbroker: WkHtmlToPdfRequestDto![](/images/permalink.svg)
WkHtmlToPdfRequestDto is the data transfer object for generating a pdf using wkhtmltopdf;
Fields
- Url string? - The url to generate pdf from. Url has precedence over HtmlBase64String value if both are set.
- HtmlBase64String string? - Base64 encoded string with html. If property Url is set, it will be used, not HtmlBase64String.
- WkHtmlToPdfArguments record {}? - Command line arguments passed to wkhtmltopdf.
- Resources record {}? - 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.
Integer types![](/images/permalink.svg)
Import
import ballerinax/pdfbroker;
Metadata
Released date: over 1 year ago
Version: 1.5.1
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 0
Weekly downloads
Keywords
Content & Files/Documents
Cost/Freemium
Contributors