GraphGrid PDF
2.0
API Version 1.0
Introduction
GraphGrid PDF allows users to create PDFs using custom HTML and upload them to S3.
API
This PDF API version is 1.0 and as such all endpoints are rooted at /1.0/
. For example, http://localhost/1.0/pdf
(requires auth) would be the base context for this PDF API under the GraphGrid API deployed at http://localhost.
Status
Check the status of GraphGrid PDF. Will return a status of 200 OK
if healthy.
- BaseURL:
/1.0/pdf/status
- Method: GET
Request
curl --location --request GET "${API_BASE}/1.0/pdf/status"
Response
200 OK
Create and upload PDF
Using a custom HTML document uploaded to S3, create and upload a PDF to a bucket.
- BaseURL:
/1.0/pdf/printer/report
- Method: POST
curl --location --request POST "${API_BASE}/1.0/pdf/printer/report" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"inputs": [{
"input": {
"inputFile": {
"name": "<!DOCTYPE html><html><body><p>test report</p></body></html>",
"origin": "plain_html"
},
"images": [{
"name": "graphgrid_logo.svg",
"origin": "local_jar"
}],
"converting": "nothing"
},
"settings": {
"styleSheet": {
"name": "gg_test_report.xsl",
"origin": "local_jar"
},
"settingsFile": {
"name": "config.xml",
"origin": "local_jar"
}
}
}, {
"input": {
"inputFile": {
"name": "test-report.html",
"origin": "s3"
},
"images": [{
"name": "graphgrid_logo.svg",
"origin": "local_jar"
}],
"converting": "gg_test_csv_to_html"
},
"settings": {
"styleSheet": {
"name": "gg_test.xsl",
"origin": "local_jar"
},
"settingsFile": {
"name": "config.xml",
"origin": "local_jar"
}
}
}],
"output": {
"name": "test-bucket/test-report.pdf",
"destinationType": "s3"
}
}'
Response
200 OK
Replace and upload PDF
Using an HTML file saved in S3, design and replace custom attributes in the document to create and upload a PDF document to a bucket.and download the created PDF.
- BaseURL:
/1.0/pdf/printer/report/replacementPdfReport/{{fileName.html}}
- Method: POST
curl --location --request POST "${API_BASE}/1.0/pdf/printer/report/replacementPdfReport/exampleText.html" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"bucket": "s3.us-west-2://test-bucket/",
"replacements": {
"{{attribute_271000005}}": "",
"{{attribute_278008002}}": "",
"{{attribute_100000004}}": ""
"{{note}}": "This is my test note",
"{{name}}": "GraphMaster",
"{{description}}": "An example PDF",
},
"keys": [
"NotoMono-Regular.ttf",
"NotoSans-Bold.ttf",
"NotoSans-BoldItalic.ttf",
"NotoSans-Regular.ttf"
],
"config": "config_fonts_rep.xml",
"regular": "regular_promotion_rep.xsl"
}'
Response
This request will return the PDF in its raw form where it can be saved and exported as a PDF.
%PDF-1.4
%����
1 0 obj
<<
/Creator (Apache FOP Version 2.1)
/Producer (Apache FOP Version 2.1)
/CreationDate (D:20220909172555Z)
>>...
...%%EOF
Save this response in a text editor and export it as a PDF. If using an API client such as Postman, it is possible to download the response directly without having to create a file in a text editor.