cancel
Showing results for 
Search instead for 
Did you mean: 

Creating pdf file.

Former Member
0 Kudos

Hello,

I need to create a application in Web dynpro Java with following functionality.

There will be a drop down button which will have options for type of letter to be displayed.

Once selected a value from drop down, user will click a submit button.

Now, a RFC will be called which will fetch data from R/3 system and that output data will be used to create this form.

User can save this file in his local desktop.

Now this file would be a pdf file.

My question is, how can I create this popup pdf file in web dynpro for java.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185086
Active Contributor
0 Kudos

Hi

Use the following code to generate pdf from popup.

try
		{
			if (window != null)
			{
				window.destroyInstance();
			}
			IWDResource resource= wdContext.currentPdfDataElement().getO_Inv_Bin();
			window= wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()), "Browser-description");
			window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
			window.removeWindowFeature(WDWindowFeature.MENU_BAR);
			window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
			window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
			window.setWindowSize(780, 430);
			window.setWindowPosition(20, 140);
			window.show();
		}
		catch (RuntimeException e)
		{
			// TODO Auto-generated catch block
			logger.errorT("Error in method getPrintPDFService of " + this.getClass().getName());
			logger.errorT("================Error====================\n" + e.toString());
			e.printStackTrace();
		}

Only point to remember is wdContext.currentPdfDataElement().getO_Inv_Bin(); is a content attribute of type binary which contain the binary data coming form RFC (backend).

BR

Satish Kumar

Former Member
0 Kudos

Thankyou Satish,

I need to generate this pdf file as a popup.

Their is no such requirement that PDF is to be triggered from some popup window.

To be very simple I dont need a popup window.

The home page of my application will have to button called "Generate PDF".

When user clicks on this button, a pdf file will be opened.

Former Member
0 Kudos

I understand that I can use "The iText API" java api.

But is their not any alternate for using external API. Is there not any inbuilt Webdynpro Java API that creates a similar PDF file.

former_member185086
Active Contributor
0 Kudos

Saurabh, I understood what you want.

Since you want to use WD API only , so given solution was simplest one, that it will open a window from there you can save or print PDF data its like a external popup which contains the PDF. alternatively you can use the ADS to generate PDF doc on selection of any event inside WD app only.

BR

Satish Kumar

former_member185879
Active Contributor
0 Kudos

Hello Saurabh,

IWDResource resource = WDResourceFactory.createCachedResource(new ByteArrayInputStream(wdContext.currentRFCOutputElement().getXString()),"PDF",WDWebResourceType.PDF,true);

IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.toString(),"PdfWindow");

window.show();

Use the above code to open.

Regards

Nizamudeen SM

Former Member
0 Kudos

Thnkyou Nizammudin and Satish.

I am suppose to write such piece of code after 4 days.

I will try the solution given by both of you.

If in case I face any difficulties, I would defenitly revert back.

Former Member
0 Kudos

Hi Saurabh,

Creating a pdf in Web dynpro Java, you can create word, pdf , etc

According to your requirement , you will input x, y and you will bring .... a,b,c,d from backend, but how you will display in

hte pdf? if wil be in line by line fashion or spacing. That is you wont have control of designing of pdf.

So, try to think of this way if it suits.

Web dynpro java, function module , smartform.

From webdynpor java give input , a, b...... through Function module fetch the data from r3 ... pass those to smartform,,,,

any way you design the output in the pdf....send back to ....Webdynpor java appliction,,, (that smartform is converted into pdf) .

Now there is a save button or print button in pdf,,, so save or print...according to your need.

Regards,

Srinivas

Edited by: srinivasa rao on Feb 28, 2011 3:07 PM

Former Member
0 Kudos

Thankyou srinivas for your suggetion.

But i guess Smartforms require additional license to be purchased !!

Former Member
0 Kudos

As far as I know, Smartforms does not require any license.

The other alternative is to use Adobe Interactive Forms, which perfectly suits your requirement, but... this requires additional licnese.

Regards,

Srinivas

Answers (0)