I wanted to create a nicely formatted PDF document out of Typeform answers. For that PDFMonkey seemed pretty nice.
Unfortunately I hit a problem with multi line (long_text) answers in PDF. They get sent to PDFmonkey with a line break which causes PDFMonkey to complain that json in unprocessable.
This is strange, especially as when you ask typeform api directly it returns json with stripped new line characters.
I could of course reformat every longform answer using formatter, but as my forms are very long, it would be a very tiresome task.
Do I feel correctly that this is kind of a bug in zapier/pdfmonkey integration? Is there some other workaround I don’t see?
Best answer by PDFMonkeyView original
@natucate - Thanks for writing to us! I’m escalating your report to Support. We would like to investigate the matter a little more deeply.
Thanks and stay tuned!
@natucate - We sent you a message about two days ago in hopes to obtain more information from you to help troubleshoot this. Could you reply to the message from Edcel if you’re still experiencing troubles with this? Thanks!
I wanted to check in with you on this one, since I don’t see a response to the message that our Support team had sent you. Did you still need help here or did their reply to you help you resolve things? Please let us know :)
The line-break issue is very frequent as JSON doesn’t support it. You can clean the data before building your payload using a Code by Zapier step and use the following JS script:
This will clean any input data you send to the script. It will replace line-breaks with HTML line breaks that PDFMonkey will understand and will also replace any tab or quote character to prevent breaking the JSON payload.
After using this code in prod I noticed a small issue with the quotes escaping, here is the correct version of the code: (the diff is the triple backslash near the end of the replace line)
I’ve ran into the same issue while using Zapier and Ninja Forms. Whenever I use a textarea field and someone adds line breaks the responses don’t flow into PDFMonkey. I tried the Code you’ve given above but it doesn’t work in my case. Do you know how I could adjust it for Ninja Forms?
@PDFMonkey I’ve just figured out how to implement the code you’ve given correctly and it works great. Thanks!
Do you know how I would adjust so that the code can fix multiple textarea responses in one zapier task?
@cfi_web, I’m sorry I didn’t see your message 10 months back. I hope since then you found out that the code can be set in a single task that can take multiple items as input.
A Code task takes an initial input mapping where you can set the name to use on the left side and the content to clean on the right. You can then pass the cleaned up content to PDFMonkey while only introducing a single extra task.
Also know that since then we have released a new version of the integration that simplifies things a lot by allowing to provide your data as a simple key/value mapping and not needing to write JSON. It eliminates this line-break issue completely when you use it 😊
Thanks for the follow-up and insight here,