Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Download Document of Record PDF with Form Data with Button In Adaptive Form

Avatar

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
techddx
Level 2

29-03-2021

Hello,

 

I currently have a use case where the user fills in the adaptive form and should be able to download the Document of Record PDF (XDP template) with the form data by clicking a button. The purpose of this use case is so the entered data is not stored in AEM or a database, so the adaptive form only serves as a form filler.

 

From my initial findings, there is a Java API you can use to generate the DoR:

https://helpx.adobe.com/experience-manager/6-3/forms/javadocs/com/adobe/aemds/guide/addon/dor/DoRSer...

 

What would be the best way to implement this API for use in an adaptive form? I would like this to be used for a majority of my forms. Thank you

Replies

Avatar

Avatar
Give Back
Level 1
LGND_DOLLA
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Give Back
View profile

Avatar
Give Back
Level 1
LGND_DOLLA
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Give Back
View profile
LGND_DOLLA
Level 1

07-04-2021

Thank you so much for your help. Keep doing what you do my great man

Avatar

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
techddx
Level 2

07-04-2021

Issue was resolved, it was due to another bundle deployed with the same groupId and it had to be uninstalled.

Avatar

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

163 likes

Total Posts

233 posts

Correct Reply

36 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

163 likes

Total Posts

233 posts

Correct Reply

36 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
GirishBedekar
Level 7

07-04-2021

Good to know

is the pdf being generated?

Avatar

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
techddx
Level 2

07-04-2021

The servlet is working and the PDF is being generated with a button ajax call. However the generated PDF is corrupt. Here is my code in the button:

 

/**
* Get pdf
* @Return {OPTIONS} drop down options 
 */
function getPdf()
{
    console.log("in view pdf");
    window.guideBridge.getDataXML(
        {
        	success: function(result) {
             var formData = new FormData();
             formData.append("dataXml",result.data);
			console.log("got data"+result.data);
           	var settings ={
            				"async": true,
							"url": "/bin/streampdf",
							"method": "POST",
                			data:{'data':result.data},
   						}
            $.ajax(settings).done(function(response)
            {
                console.log("got response from POST");
				var file = new Blob([response], {
                type : 'application/pdf'
                });
                var fileURL = URL.createObjectURL(file);

                var a         = document.createElement('a');
                a.href        = fileURL; 
                a.target      = '_blank';
                a.download    = 'form.pdf';
                document.body.appendChild(a);
                a.click();
            })

    	},
    	error:function(guideResultObject) {console.log("got error"); },
        guideState : null,
        boundData  : true});

}

Avatar

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

163 likes

Total Posts

233 posts

Correct Reply

36 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

163 likes

Total Posts

233 posts

Correct Reply

36 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
GirishBedekar
Level 7

07-04-2021

Save the pdf to local file system after it is generated 

Avatar

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
techddx
Level 2

07-04-2021

I am testing by saving it to local system first, and the PDF is successfully generated. However, when trying to get the file from button AJAX call, the PDF is corrupt.

Avatar

Avatar
Boost 25
Level 3
gbedekar
Level 3

Likes

26 likes

Total Posts

34 posts

Correct Reply

9 solutions
Top badges earned
Boost 25
Ignite 5
Ignite 3
Ignite 1
Give Back 3
View profile

Avatar
Boost 25
Level 3
gbedekar
Level 3

Likes

26 likes

Total Posts

34 posts

Correct Reply

9 solutions
Top badges earned
Boost 25
Ignite 5
Ignite 3
Ignite 1
Give Back 3
View profile
gbedekar
Level 3

08-04-2021

Your Adaptive Form is based on the XDP template? and you are able to merge the data with the xdp template using the DoR API. Can you please confirm?

Avatar

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Validate 1
Level 2
techddx
Level 2

Likes

12 likes

Total Posts

67 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
techddx
Level 2

08-04-2021

Yes, the adaptive form is based on an XDP template and the data is being merged with the DoR API. I was able to resolve my issues and generate a functional PDF. I will share my solution shortly.