Version 1.2 Last updated 02/11/2024
You can use URL parameter values in your PDF template. For example, if the URL parameter is param1 and value is John then the parameter of URL will be
?param1=John
In this case, the parameter param1 can be used in the PDF template.
My name is {param1}
This parameter param1 will be replaced to value John when the template is generated.
The resulting value will be My name is John
Also you can set the image source as variable in URL.
?param1=John&mypicture=https://.../water1.jpg
The second parameter mypicture will be transformed into the image with base64 encoding.
My photo is [image.mypicture]
My photo is <img src="data:image/jpeg;base64...">
You could use API for getting data into PDF template and you could use all URL parameters for this operation.
For example, if you need to make request
//anysite.com/api/v1/data1/data2?any=data3
and this parameters can always be changed than you could replace API URL in PDFGun like this
//anysite.com/api/v1/{param1}/{param2}?any={param3}
In this case, the request part your PDF URL will be transformed to:
?param1=data1¶m2=data2¶m3=data3
After this simple manipulation with backend API URL you can make unlimited requests inside PDFGun and get different JSON data for PDF generating.
Your API requests always will be hidden inside the PDFGun service. PDFGun supports transferring different URL parameters into API header request.
You could setup Authtorization, Content-Type and other custom header parameters in API header before running the API request.
Further if your API request had already done without errors you could use data from API for PDF transforming. First, PDFGun supports a single array in JSON.
[ { "param": "my data number one" }, { "param": "my data number two" } ]
Second, you could use multiple arrays in JSON data.
{ "data1": [ { "param": "my data number one" }, { "param": "my data number two" } ], "data2": [ { "param": "my data number one" }, { "param": "my data number two" } ] }
{ "parent": { "child": "my data" } }
{ "parameter": "my data" }or in URL
?parameter=my%20datawill be replaced to my data before generating PDF document.
{ "parent": { "child": "my data" } }object {parent.child} will be transformed to my data in PDF
[ { "param": "my data number one" }, { "param": "my data number two" } ]In this case, using [begin] [end] pattern in PDF template and writing parameter{param} inside [begin] [end] like this [begin] {param} [end] will be transformed to my data number one, my data number two in PDF
{ "data": [ { "param": "my data number one" }, { "param": "my data number two" } ] }inside [beginTable.data] [endTable.data] annotation you could use {param} pattern for replacing data. In this example, [beginTable.data] {param}, [endTable.data] will be transformed to my data number one, my data number two
{ "data": [ { "param": "my data number one", "picture": "https://.../water1.jpg" }, { "param": "my data number two", "picture": "https://.../water2.jpg" } ] }Inside [beginTable.data] [endTable.data] annotation you could use [image.picture] structure for downloading water1.jpg and water2.jpg into PDF document. In this example, PDFGun pattern string
my data number one is <img src="data:image/jpeg;base64...">, my data number two is <img src="data:image/jpeg;base64...">
<img src="data:image/jpeg;base64...">
{ "data": [ { "id": 1, "picture": "https://.../water1.jpg" }, { "id": 2, "picture": "https://.../water2.jpg" } ] }If you want to dasable showing object with id == 2 you could use expression pattern [hideRowIf.id==2]
{ "data": [ { "id": 1, "picture": "https://.../water1.jpg" }, { "id": 2, "picture": "https://.../water2.jpg" } ] }and you want to hide key with id == 2 you could use this pattern in PDF template