Convert PDF Form to Blob, Base64 URL, or Raw PDF

Sorry, we can't retrieve the data from server. Please comeback later.

Besides being able to download fillable survey forms as document files in a traditional PDF format, you can get them in other formats as well. These formats are mainly used to display PDF content in HTML inline, transfer PDF forms over the web, or store them in a database. This example shows how to get raw PDF content or convert it to Blob or a Base64-encoded data URL.

Get Raw PDF Content

You can get a string value that includes document metadata and content according to the PDF specification. To do this, call the raw(type) method without arguments:

surveyPDF.raw().then((rawcontent) => {
  // ...

Convert PDF to Blob

A Blob (or Binary Large Object) is an array of binary data. The Blob format is designed primarily to store images, video, and other multimedia content. To export a PDF document as a Blob or Blob URL, pass "blob" or "bloburl" to the raw(type) method of a SurveyPDF instance:

surveyPDF.raw("blob").then((blob) => {
  // ...
surveyPDF.raw("bloburl").then((bloburl) => {
  // ...

This demo shows how you can save an editable PDF document directly (by calling the save() method) or by getting a Blob URL first.

Convert PDF to Base64 Data URL

A Base64 Data URL is a string that contains Base64-encoded binary data preceded by the word data, an MIME type that indicates the data type, and an optional base64 prefix for non-textual data. Data URLs are mostly used to insert media content into HTML inline. Refer to the following MDN article for more information: Data URLs.

To get a survey PDF file as a data URL, pass "dataurlstring" to the raw(type) method:

surveyPDF.raw("dataurlstring").then((dataurlstring) => {
  // ...

This demo uses a data URL to display a preview of a survey PDF file.

Why we use cookies.

This site uses cookies to make your browsing experience more convenient and personal. Cookies store useful information on your computer to help us improve the efficiency and relevance of our site for you. In some cases, they are essential to making the site work properly. By accessing this site, you consent to the use of cookies.

For more information, refer to DevSoft Baltic’ privacy policy and cookie policy.