Jump to content
JasperReports Library 7.0 is now available ×

autoprint pdf report


2005 IR Help

Recommended Posts

By: Jorge - jorarcia

autoprint pdf report

2004-05-10 03:00

 

I don't know if it's possible, but I want to redirect the pdf to the printer. Anybody know's how? Thanks in advice.

 

 

 

 

By: akmal Sarhan - akmal88

RE: autoprint pdf report

2004-05-10 08:47

this might be what you are looking for:

 

public void print() throws UnsupportedFormatException

{

save("./tmp.pdf");

 

try

{

String osName = System.getProperty("os.name");

 

//FOR WINDOWS 95 AND 98 USE COMMAND.COM

if (osName.equals("Windows 95") || osName.equals("Windows 98"))

{

Runtime.getRuntime().exec("command.com /C start acrord32 /p " + "./tmp.pdf");

}

 

//FOR WINDOWS NT/XP/2000 USE CMD.EXE

else

{

Runtime.getRuntime().exec("cmd.exe /C Start acrord32 /p " + "./tmp.pdf");

}

}

catch (IOException IOE)

{

JOptionPane.showMessageDialog(null, IOE.getMessage(), "RuntimeException", JOptionPane.ERROR_MESSAGE);

}

}

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...