Skip to main content

· One min read
James A. Brannan

DynamicPDF CloudAPI Designer now supports Google Fonts, significantly expanding the number of fonts available to you when creating a PDF document.

Designer supports adding a Google Font through the font property. You can set the font for any Formatted Text Area, Label, Page Numbering Label, Record Area, or Record Box. To add a Google Font,

  • click ... to open the Font Selector dialog,
  • select Google from the Type dropdown,
  • select the particular font from the Fonts list,
  • select the desired style from the Styles list,
  • click Select to select the font.

· 4 min read
James A. Brannan

DynamicPDF Cloud API's client libraries greatly simplify adding our endpoints to your applications. But you are not limited to using one of our provided client libraries. Although a Python client library is in the works, using Python to call the Dynamic-PDF Cloud API's endpoints is straightforward.

The following three examples demonstrate the ease of using Python to call the dlex-layout, pdf-info, and pdf endpoints.

Python requests module

The Requests: HTTP for Humans Python library is an easy-to-use HTTP library that is built on the urllib3 library.

The library makes sending and HTTP requests easy and handles adding query strings to URLs and form encoding your POST data. The following three examples illustrate using Python's Requests library to call DynamicPDF Cloud API from your Python applications.

Using flex-layout Endpoint

The dlex-layout endpoint takes a file on your local system containing JSON data used by a DLEX file to create a PDF report.

info

Refer to the dlex-layout documentation for more information on using this endpoint.

The following example illustrates. The example first gets the DlexPath from DynamicPDF Cloud Storage.

info

The files in this example refer to the creating-pdf-dlex-layout-endpoint example, available from the Resource Manager samples.

The example next gets the LayoutData from your local file system. The Requests library then makes a POST request and returns the PDF as binary. Finally, the output is written into a PDF file.

import requests

dataFile = "c:/temp/creating-pdf-dlex-layout.json"
outputFile = "c:/temp/dlex-layout-python.pdf"

url = "https://api.dynamicpdf.com/v1.0/dlex-layout"
apiKey = "Bearer <api-key>"

file = {'LayoutData': open(dataFile, 'rb')}

r = requests.post(url, files=file,
headers={'Authorization': apiKey},
data={'DlexPath': 'samples/creating-pdf-dlex-layout-endpoint/creating-pdf-dlex-layout.dlex'})

with open(outputFile, 'wb') as fd:
for chunk in r.iter_content(chunk_size=128):
fd.write(chunk)

Using pdf-info Endpoint

The pdf-info endpoint obtains a PDF from your local file storage or DynamicPDF Cloud Storage, extracts metadata about the PDF, and then returns the extracted information as a JSON document.

info

Refer to the pdf-info documentation for more details on using this endpoint.

While the previous endpoint obtained the JSON layout data as a form's file input, the PDF's bytes are the request content here.

info

The files in this example refer to the merge-pdfs-pdf-endpoint example, available from the Resource Manager samples.

The POST command streams the file's content to the endpoint and returns a text string containing the JSON.

import requests

filePath = "c:/temp/merge-pdf/DocumentA.pdf"

url = "https://api.dynamicpdf.com/v1.0/pdf-info"
apiKey = "Bearer <api-key>"

file = open(filePath, 'rb')

r = requests.post(url, data=file, headers={'Authorization':
apiKey,'Content-Type':'application/pdf'})

print(r.text)

The example then prints the output to the console.

{
"author":null,
"subject":null,
"keywords":null,
"creator":null,
"producer":"DynamicPDF Core Suite (Generator, Merger and ReportWriter) for .NET v11.09",
"title":null,
"pages":[
{"pageNumber":1,"width":612,"height":792}
{"pageNumber":2,"width":612,"height":792}
],
"formFields":null,
"customProperties":null,
"xmpMetaData":false,
"signed":false,
"tagged":false,
"formFieldCount":0
}

Using pdf Endpoint

In this final example, you use the pdf endpoint to merge three documents. The pdf endpoint allows more complex processing by including an Instructions document.

info

Refer to the pdf documentation for more information on using this endpoint.

Use the pdf endpoint to create simple one-page PDF documents (cover pages, for example), create documents/reports using DLEX files, convert images to PDFs, and merge PDFs into a combined PDF.

info

The files in this example refer to the merge-pdfs-pdf-endpoint example, available from the Resource Manager samples.

The endpoint takes a form field submission as a POST request. It first gets the PDFs, DocumentA.pdf and DocumentB.pdf, from your local system and then get's DocumentC.pdf from your cloud storage. The local files specify the form inputs as Resource. The Instructions input refers to the JSON instructions JSON document. The endpoint first uploads the two local PDFs and the instructions document. It then opens the instructions document and parses the file.

{
"author": "Alex Smith",
"inputs": [
{
"type": "pdf",
"resourceName": "DocumentA.pdf",
"startPage": 1,
"pageCount": 1
},
{
"type": "pdf",
"resourceName": "DocumentB.pdf"
},
{
"type": "pdf",
"resourceName": "samples/merge-pdfs-pdf-endpoint/DocumentC.pdf"
}
]
}

An instructions document contains one or more pdf, dlex, html, image, or page inputs that perform processing. After processing the inputs, the instructions merge the resultant PDFs into a combined PDF.

info

Refer to the pdf inputs topic in the user documentation for more information on the pdf endpoint and inputs.

import requests

filePath1 = "c:/temp/DocumentA.pdf"
filePath2 = "c:/temp/DocumentB.pdf"
instructionsPath = "c:/temp/instructions.json"
outputFile = "c:/temp/pdf-merge-python.pdf"

url = "https://api.dynamicpdf.com/v1.0/pdf"
apiKey = "Bearer <api-key>"

files = [
('Resource', ('DocumentA.pdf', open(filePath1, 'rb'))),
('Resource', ('DocumentB.pdf', open(filePath2, 'rb'))),
('Instructions', ('instructions.json',
open(instructionsPath, 'rb')))]

r = requests.post(url, files=files,
headers={'Authorization': apiKey})

with open(outputFile, 'wb') as fd:
for chunk in r.iter_content(chunk_size=128):
fd.write(chunk)

As the above three examples illustrate, using the DynamicPDF Cloud API with your Python applications is easy. This ease is especially apparent when using the Requests Python library. But stay tuned; the DynamicPDF Cloud API developers are busy creating a Python client library, which we will announce as soon as it's released..

· 5 min read
James A. Brannan

The DynamicPDF Client libraries make using the DynamicPDF Cloud API a breeze. We have Node.js, .NET, Java, PHP, and Go client libraries. But sometimes, you might want to call the DynamicPDF Cloud API directly as a REST call to your project without using any coding. In this blog post, we use the .bubble.io API to call the dlex-layout endpoint directly as a REST call with no coding.

info

The instructions below, although particular to bubble.io also apply to other online no-code platforms such as Retool, WaveMaker, Betty Blocks, DronaHQ, and others.

bubble.io

The bubble.io allows developer to create interactive websites and APIs using no coding. To use bubble.io register for free account.

info

This post does not provide a bubble.io introduction or discuss integrating your plugin into an app, only how to create the plugin. For using plugins, refer to the Bubble.io documentation.

Also, if you do not have a DynamicPDF Cloud API account, register for a free account here. Both offer free accounts and allow you to upgrade as needed seamlessly. Refer to the numerous examples and documentation (Getting Started).

Refer to the bubble.io documentation for complete documentation on creating and using an API; here, we illustrate using the Add another call button to add a call to your API.

Creating a New Plugin

The first step in creating a new plugin is to navigate to the Plugins page and create a new one (figure 1).

  1. Click on the Plugins tab to be taken to the Plugins screen.
  2. Click the Create a plugin button to create a new plugin.

Figure 1. Creating a new plugin.

  1. Name the new plugin DynamicPDF Endpoint Example then click Create plugin.

Figure 2. Naming the plugin.

Creating the Plugin

After initially creating a new plugin it takes you to the details screen for creating the plugin (figure 3).

  1. Add an image as your logo. I chose the DynamicPDF CloudAPI logo.
  2. Add an endpoint description to the Description field.
  3. Select a category for the plugin (I chose Technical).

Figure 3. Describing the plugin.

Plugin API Calls

After describing the plugin you create the plugin details by completing the Plugin API Calls tab (figure 4).

  1. Select the API calls tab to be taken to the Plugin API Calls screen.
  2. Assign a name to the API Name.
  3. Select Add another call to expand and show the fields needed to define the API call.

Figure 4. Creating the Call.

After selecting Add another call, the screen adds more fields to enter the call's details (figure 5).

  1. Assign a name for the call (here dlex-layout-call). Select Data from the Use as dropdown and select File from the Data type dropdown.
  2. Select POST and add the URL to the REST call (https:://api.dynamicpdf.com/v1.0/dlex-layout) .
  3. Click Add header to add a new header.
  4. Assign Authorization as the Key and write Bearer for the value.

Now you must get the authorization key from your DynamicPDF account.

  1. Go to your DynamicPDF CloudAPI account and select Apps and API Keys.
  2. Copy your API key by clicking [copy].
  3. Paste the value to the field after Bearer, the complete value is Bearer *your api key value*.

Figure 5. Add your API key as a header parameter.

After creating a header and adding your API key, you create a form field for the path to your DLEX file.

info

Here the DLEX file is in your DynamicPDF Cloud Storage and you use the relative path in DynamicPDF CloudAPI.

  1. Click Add parameter to create a new parameter.
  2. Select Form-data as the Body type.
  3. Assign DlexPath as the Key.
  4. Navigate to your DynamicPDF account and select Manage Resources.
  5. Navigate to the dlex-layout folder in the samples folder, highlight the file path, right-click, and select Copy File Path to copy the file path to your clipboard.
  6. Paste the value for the parameter in the Value field.

Figure 6. Adding the DlexPath to the call.

After adding the API key and the DlexPath, add the path to the layout data (figure 7).

tip

You layout data is your organization's private data, although nothing prevents you from storing it in the DynamicPDF CloudAPI's Cloud Storage, here we envision it is stored in your local system.

  1. Click Add parameter to add another parameter.
  2. Assign LayoutData as the Key.
  3. Check the Send file checkbox.
  4. Click Upload to open a file dialog.
  5. Select the file to upload the layout data (SimpleReportWithCoverPage.json).

Figure 7. Adding the LayoutData to the call.

  1. Click Reinitialize call to reinitialize it.
  2. Click to preview the call.

Figure 8. Initializing and previewing the API call.

After clicking the preview link, your newly created API calls the dlex-layout endpoint and opens the created PDF in a new browser tab (figure 9).

Figure 9. Previewing the dlex-layout API call's resultant PDF.

Conclusion

Upon clicking the Plugins tab, you will see your newly created API listed (figure 10). You can edit the API and when satisfied, you can register it so that others can use the API or you can use it privately in your own applications. Refer to the bubble.io documentation for more information on using your API.

Figure 10. Your newly created plugin.

Although using the DynamicPDF CloudAPI with one of it's client libraries is the most robust way to use the CloudAPI, it is also easily integrated into one of the available codeless development tools available on the web.

· One min read
James A. Brannan
Example banner

The Go programming language client library is now available. Download the client library's source from GitHub. Also, check out the new examples on GitHub illustrating how to use this library with the Cloud API.

Client libraries make using the DynamicPDF Cloud API a breeze. We already have client libraries written in Node.js, .NET, Java, and PHP. And now we have a fifth client library, Go. Get started using Go today!

· One min read
James A Brannan

We here at the DynamicPDF Cloud API are excited to announce that the DynamicPDF Cloud API can now convert HTML to PDF. With the addition of a new input type to the pdf endpoint, you can easily convert HTML pages to PDF documents. And you can specify raw HTML or a file path in your local storage system or in the DynamicPDF Cloud Storage. And we updated all client libraries to support HTML conversion. The HTML input type can also be mixed with other input types such as PDF, image, DLEX and page to create PDF documents with pages from multiple sources.

· One min read
Andrew Cochran

We've been busy here at DynamicPDF. We've just about completed BETA testing on a new HTML to PDF feature of the Cloud API. We expect it to be released in January 2023.

We're also working on a new PDF rasterization feature. This will make it possible to convert PDF documents to images. BETA testing will begin shortly, and we expect this to be released in 2023.

Happy Holidays!

· One min read
James A. Brannan

We at DynamicPDF are happy to announce the following tutorials, now available online. These tutorials illustrate how to use DynamicPDF Designer to create rich, dynamic PDF reports.

Designer
Designer - Quick Tour
Create a Page
Create a Report
Create a Sub Report
Create a Page Using a Template
Create a Report Using a Template
Use a Report using the dlex-layout Endpoint

Learn how to use the DynamicPDF Cloud API's Designer today by completing the Designer reports.

· One min read
James A. Brannan

We at DynamicPDF are happy to announce the following tutorials, now available online. Available now are written and video tutorials covering all DynamicPDF Cloud API's REST endpoints.

EndpointTutorial
pdfMerging PDFs
Completing an AcroForm
Creating a PDF from DLEX
Adding Bookmarks to a PDF
dlex-layoutCreate a PDF from DLEX
image-infoExtract Image Metadata
pdf-infoExtract PDF Metadata
pdf-textExtract PDF's Text
pdf-xmpExtract XMP Metadata

Each tutorial includes examples using the following client libraries.

  • Java
  • C# .NET
  • Node.js
  • PHP

Be sure to check out the tutorials for step-by-step instructions on calling each endpoint using one of the client libraries or using a direct REST call using cURL.

· One min read
James A. Brannan

Recently we started creating numerous written tutorials and video tutorials to help you get started using the DynamicPDF Cloud API. We are happy to announce our first tutorial: Getting Started - DLEX and Designer.

This short tutorial illustrates how to create a simple dynamic PDF report. We first use DynamicPDF Cloud API's Designer to create a DLEX report template and associated JSON data. After creating the DLEX file, we illustrate using DynamicPDF Cloud API's dlex-layout REST endpoint to process the DLEX file and generate a PDF document.

The tutorial is designed as your "first steps" using DynamicPDF Cloud API, so be sure to check it out.

Getting Started - DLEX and Designer