PDF delivery over email

New delivery method has been added to PDFMark’s API. You can get the generated PDF document delivered via email. The generated document is sent as an attachment in the email.

Following parameters have been added to the API

email_to: Specify one or more email ids where the document should be emailed. You can provide multiple email ids separated by a comma.
email_cc: Email ids which should be marked in CC for the email. Multiple email ids can be provided separated by a comma.
email_bcc: Email ids which should be marked in BCC for the email. Multiple email ids can be provided separated by a comma.
email_subject: The subject of the email. If not provided, a default subject will be used.
email_body: The main body of the email. If not provided, a simple line indicating that the document is attached to the email will be used.

Delivery over email means you no longer have to write your own code to send a PDF to the end recipient via email.

WebhookTest – Test your webhooks

Do you need to test a webhook while integrating a third part API like PDFMark’s? We have for you WebhookTest.com. It is a free service for developers to test and inspect the data being posted by an API as a webhook callback.

A webhook is a request sent by a server to another server upon some event. It’s a server to server communication which happens when some event occurs, like completion of a task or failure in execution of some task. Since the communication is server to server, it becomes difficult for developers to observe what data is being sent to a webhook by the calling server. That is where WebhookTest comes in.

WebhookTest provides the developers with a unique URL which the developers can use as a temporary webhook in the service they are integrating. Developers can see in real time the data being posted to the webhook at a given URL. Developers can also choose to get the posted data forwarded to their email id, so that if any data is posted while the developer is not around to witness it, they still get to see it in the email.

WebhookTest show details like HTTP header of the incoming request, source IP, raw data being posted and values sent via query string (GET) and form fields (POST).

Check out webhooktest.com.

How to generate PDF documents programmatically

Do you need to generate PDF documents programmatically for your business or client? May be it’s an invoice or an agreement or a report or a ticket. The best and easiest way to create PDF documents via code is to create them as HTML – which gives you flexibility over how it looks. You can style the document with CSS and convert the HTML to PDF.

There are various ways to convert HTML to PDF. wkhtmltopdf is a popular open source command line tool to convert html to pdf.

wkhtmltopdf http://google.com google.pdf

Headless Chrome is another option. Headless Chrome is better because nothing can render HTML better than a browser.
Puppeteer is a NodeJS library that you can use to interact with headless Chrome and save an HTML file as PDF.

const puppeteer = require('puppeteer');
 
async function createPDF() {
  const browser = await puppeteer.launch({ headless: true });
  const page = await browser.newPage();
  await page.goto("https://www.google.com", {
      waitUntil: 'networkidle2',
    });
  const pdf = await page.pdf({ 
    path: '/path-save-pdf.pdf'
  });
 
  await browser.close();
});

If you do not want to bother with setting up headless chrome and Puppeteer and command line utilities like wkhtmltopdf, we have created a simple REST API based on headless chrome to generate PDF programmatically from HTML.

We have done all the hard work so you don’t have to and you can focus on the core aspects of your application and leave the PDF generation to our API.

PDFMark’s HTML to PDF API is a simple REST API, using which you can convert your HTML to PDF in seconds.

curl --location --request POST 'https://api.pdfmark.com/pdf' \
--header 'key: demokey' \
--header 'Content-Type: application/json' \
--data-raw '{
"html" : "<html> <body> <h1> Hello World </h1> </body> </html>"
}'

You can customize the PDF by specifying page size, margins, header and footer. You can watermark the document and protect it with password and even prevent users from copying or printing if required.

PDFMark has very easy to use and extensive documentation.

What’s more, PDFMark even saves the generated PDF in cloud for you, and you can server it directly to your end users via our fast global CDN.

Check out the demo of PDFMark’s API at pdfmark.com and sign up to get your API key and start generating PDF documents programmatically in your favorite programming language.

HTML to PDF REST API by PDFMark

We are glad to announce the launch of PDFMark.com, a REST API for developers to generate PDF documents from HTML content or URL.

PDFMark allows developers to convert their HTML or a URL to PDF documents effortlessly and it even stores it on cloud and serves it to end users via a super fast Content Delivery Network (CDN).

PDFMark provides a simple and easy to use REST API which can be called from any programming language and generates a PDF document within seconds.

Here are the features of PDFMark

  • REST API to convert HTML to PDF
  • Create PDF documents from raw HTML or a URL
  • PDF customization options – specify page size, margin, orientation
  • Insert header and footer in the PDF in the form of HTML
  • Generate PDF in greyscale
  • Auto insert QR codes in the PDF documents
  • Password protect generated PDF and restrict copy, edit and print functionality
  • Support for templates for PDFs that need to be generated frequently
  • Insert watermarks in the PDF document
  • Insert custom CSS and JavaScript in external URL before converting them to PDF
  • Specify delay to allow execution of JavaScript before converting a URL to PDF
  • Webhook callback support for PDF generation, get notified when PDF is created
  • Cloud storage of generated PDF files and delivery via CDN

Check out the demo of the API at pdfmark.com

Take a look at API documentation and sign up to start generating PDF documents within minutes.