How To Convert Base64 to PDF attachment

ACC Tips & Tricks, Adobe Campaign
1 minute read

In this article, I will provide a simple trick for converting Base64 encoded data to PDF using JSAPI in Adobe Campaign Classic. Due to AC’s inability to attach Base64-encoded files directly to emails, this method can prove to be highly useful.

Base64 data format that would be easy to use when supperted by Adobe Campaign Classic:

data:applcation/pdf;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA

To accomplish this task, we must first decode the incoming file using a memory buffer and save it as a file. Once saved, we can then reference the file while attaching it dynamically for each recipient.

While there may not be many practical examples of the functions outlined in the JSAPI documentation, with some online research, I was able to locate a helpful example for using a memory buffer.

A memory buffer is a data structure that is used to store data temporarily in computer memory. It is a contiguous block of memory that can be accessed and manipulated like an array, but its size can be dynamically adjusted as needed.

Memory buffers are commonly used in programming languages like JavaScript to manipulate and process binary data such as images, audio files, and PDFs.

var memBuff = new MemoryBuffer(),
    f = new File("path/to/export/test.pdf");

memBuff.appendBase64('JVBERi0xLBzb ... Cg==');"a");

This script creates a new memory buffer object called “memBuff”. It also creates a new file object called “f” and assigns it the file path “path/to/export/test.pdf”.

The script then appends Base64 encoded data to the memory buffer using the “appendBase64” method.

Next, the file is opened with the “open” method in “append” mode (“a”), which means the data will be added to the end of the file. The memory buffer is then converted to a string using the “toString” method and written to the file using the “writeln” method. Finally, the file is closed using the “close” method.

In summary, this script reads Base64 encoded data from a memory buffer and writes it to a file in PDF format.

Adobe campaign tips and tricks
ACC Tips & Tricks, Adobe Campaign, Marketing Automation

Escalate any user rights to admin

1 minute read

Normally web apps run under the web app user (which is anonymous and has very little to zero rights by default) and for certain operations you would need to require to grant additional access, or even grant full admin. To grant full admin for web app user is not solution to go with. Instead I […]

Continue reading
Adobe campaign tips and tricks
ACC Tips & Tricks, Adobe Campaign, Marketing Automation

Export connection strings from console

less than a minute read

Whether you change your laptop or want to save actual configuration for your colleagues. You can easily achieve that by taking all connection strings as XML. ims – connection over adobe id SSO Also similar approach is to directly change the connection string file nlclient_cnx.xml that is located under your local AppData folder. To quickly […]

Continue reading