How to convert a pdf form to xml or json using AngularJS

1,503 views
Skip to first unread message

jyoti ranjan

unread,
Mar 22, 2017, 12:39:50 PM3/22/17
to Angular and AngularJS discussion
Hi,

I have created a user form using adobe livecycle designer.User need to download the pdf (XFA) form,fill it and upload the pdf. I want to get extract form data in angularjs than process the data to database.I am able to do it using c# but not at client side itself using angularjs.

Sander Elias

unread,
Mar 23, 2017, 12:22:39 AM3/23/17
to Angular and AngularJS discussion
Hi Jyoti,

You can load PDF.js from Mozilla, and use that to extract the data from the PDF. That's not the only lib that enables you to do this, just the first that poped to mind!

Regards
Sander

jyoti ranjan

unread,
Mar 23, 2017, 6:25:21 AM3/23/17
to Angular and AngularJS discussion
Hi,

I have used this lib, but it extracts only text from pdf in a paragraph manner. It's not easy to get field values using field name.If i can convert it to xml than i can do this as we can do using iTextSharp in c#.

Sander Elias

unread,
Mar 23, 2017, 10:45:17 AM3/23/17
to Angular and AngularJS discussion
Hi Jyoti,

If you can do it in c#, you can do it server-side. Just process the document once, and keep the resulting json in a cache. I don't think you can do it as efficient in the browser. But if you search long enough, I'm pretty sure there is a JS library that can do what you want. Either way, not much of an Angular issue! (neverteless, if you find something, please report back, it might be interesting, even without being Angularish ;) )

Regards
Sander

jyoti ranjan

unread,
Mar 23, 2017, 1:44:30 PM3/23/17
to Angular and AngularJS discussion

Hi,

Don't know how to proceed with PDF.js from Mozilla. Could you please elaborate the process or some sample codes how to proceed further to get form data. The form is developed with Livecycle designer.It is a XFA pdf form.

jyoti ranjan

unread,
Mar 24, 2017, 12:23:11 AM3/24/17
to Angular and AngularJS discussion
Hi,

I have tried to implement but got error.

 var tmppath = URL.createObjectURL(document.getElementById('flupd').files[0]);
            PDFJS.workerSrc = "js/test1/pdf.worker.js";
        
            PDFJS.getDocument(tmppath).then(function (pdf) {
            
                pdf.getData().then(function (arrayBuffer) {
              
                    var pdfraw = String.fromCharCode.apply(null, arrayBuffer);              //Error: Uncaught (in promise) RangeError: Maximum call stack size exceeded
               
                });            
            });

jyoti ranjan

unread,
Mar 25, 2017, 1:45:21 AM3/25/17
to Angular and AngularJS discussion
Hi,

Please give some solution.

Manu L G

unread,
Mar 27, 2017, 2:56:42 AM3/27/17
to Angular and AngularJS discussion
Hey.


PDF.js is only to visualize PDF in HTML with Canvas. 

I've tried the first one to create PDF from HTML. Anyway  the best option is generating the PDF in the backend.

jyoti ranjan

unread,
Mar 28, 2017, 1:32:09 PM3/28/17
to Angular and AngularJS discussion
Hi,

How to get dynamic xfa form field values with it?

Sander Elias

unread,
Mar 29, 2017, 2:14:17 AM3/29/17
to Angular and AngularJS discussion
Hi Jyoti,

Euhm, perhaps ask in their support groups?

Regards
Sander

jyoti ranjan

unread,
Mar 29, 2017, 2:36:10 AM3/29/17
to Angular and AngularJS discussion
Hi,

They are saying to ask this in javascript / angular forum.They give support only about the form.
Reply all
Reply to author
Forward
0 new messages