+ Start a Discussion
App DevelopmentApp Development 

how to generate record from PDF in salesforce?

Consider, if we have attachment added to "Quote" object and we need to generate "order" object record from attached quote PDF based on trigger or anything.

Is it possible in salesforce to read the PDF and generate record from it?
Up to my knowledge there is no way in Apex to do the same or by any way we can implement the same.

Let me know if you have any sugesstions for the same. 
Hey App Dev,

I see 2 ways for this:
1. java solution. Find or create an external java api service that you can call from an apex class, serve it your pdf and get the content back. You could create and host on Heroku your own. https://pdfbox.apache.org/
2. javascript solution. There's a library pdf.js that can get content from pdfs. Load it in a VF page and try to proces the file there and save its content to a SFDC object. Ex: http://stackoverflow.com/questions/1554280/extract-text-from-pdf-in-javascript

Happy Monday,
App DevelopmentApp Development
Hey Adrian, Thanks for you reply! can we convert PDF to XML? 
List of more tools: http://okfnlabs.org/blog/2016/04/19/pdf-tools-extract-text-and-data-from-pdfs.html
Can't see something to apply directly to xml, but there's pdf2json based of the pdf.js library which looks pretty straight forward.
I.e.: https://gist.github.com/rgrp/5944247

What is your scenario? Why do you need xml?

Thank you,