cancel
Showing results for 
Search instead for 
Did you mean: 

How to call keys CTRL+P in WebDynpro Java

Former Member
0 Kudos

Hi,

I'm trying to print a html document into Web Dynpro but for me it's very difficult cause is a dinamically content with a lot of text. So I would like when a push the button print call the keys CTRL+P. It's possible?

Thanks and sorry for my English!

Accepted Solutions (1)

Accepted Solutions (1)

SRudra
Contributor
0 Kudos

Hi,

Yes it is possible provided you have a printer connected and properly configured. In fact you can do all operations that are availbel to your browser.

Cheers!!!

Sukanta

Former Member
0 Kudos

It's possible and how?

This the solution.... One hour after I find the solution.

public void onActionPrint(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionPrintEncuestaPDF(ServerEvent)
    try{
		Robot robot = new Robot();
		
		//CTRL+P
		robot.keyPress(KeyEvent.VK_CONTROL );
		robot.keyPress(KeyEvent.VK_P );
		robot.keyRelease(KeyEvent.VK_CONTROL );
		robot.keyRelease(KeyEvent.VK_P );
            
		//Alt+U
		robot.keyPress(KeyEvent.VK_ALT );
		robot.keyPress(KeyEvent.VK_U );
		robot.keyRelease(KeyEvent.VK_ALT );
		robot.keyRelease(KeyEvent.VK_U );
            
		//ENTER
		robot.keyPress(KeyEvent.VK_ENTER);
		robot.keyRelease(KeyEvent.VK_ENTER );
	    
    }

catch(Exception e){  }
}

Thanks

Answers (0)