|
|
|
|
@ -167,43 +167,35 @@ public class ExamePDF {
|
|
|
|
|
|
|
|
|
|
if( System.getProperty( "os.name" ).startsWith( "Windows" ) )
|
|
|
|
|
{
|
|
|
|
|
System.out.println( "Windows" );
|
|
|
|
|
Process proc;
|
|
|
|
|
proc = Runtime.getRuntime().exec( "cmd /c \"md c:" + System.getProperty( "file.separator" ) + "temp\"" );
|
|
|
|
|
proc.waitFor();
|
|
|
|
|
|
|
|
|
|
FileOutputStream fos = new FileOutputStream( "c:" + System.getProperty( "file.separator" ) + "temp" + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" );
|
|
|
|
|
// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf" );
|
|
|
|
|
FileOutputStream fos = new FileOutputStream( "c:\\temp\\" + nome + "_" + time + ".pdf" );
|
|
|
|
|
fos.write( pdf );
|
|
|
|
|
fos.close();
|
|
|
|
|
|
|
|
|
|
System.out.println( "File saved." );
|
|
|
|
|
System.out.println("cmd /c \"acrord32.lnk /t c:" + System.getProperty( "file.separator" ) + "temp" + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf " + printerName + "\"");
|
|
|
|
|
proc = Runtime.getRuntime().exec( "cmd /c \"acrord32.lnk /t c:" + System.getProperty( "file.separator" ) + "temp" + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf " + printerName + "\"" );
|
|
|
|
|
// proc = Runtime.getRuntime().exec( "cmd /c \"acrord32.lnk /t " + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf " + printerName + "\"" );
|
|
|
|
|
// proc = Runtime.getRuntime().exec( "cmd /c dir" );
|
|
|
|
|
//System.out.println("cmd /c \"c:\\temp\\acrord32.lnk /t \"c:" + System.getProperty( "file.separator" ) + "temp" + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf\" \"" + printerName + "\"\"");
|
|
|
|
|
// proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat",
|
|
|
|
|
// System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf",
|
|
|
|
|
// printerName });
|
|
|
|
|
proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat",
|
|
|
|
|
"c:\\temp\\" + nome + "_" + time + ".pdf",
|
|
|
|
|
printerName });
|
|
|
|
|
proc.waitFor();
|
|
|
|
|
if( !new File( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" ).delete() )
|
|
|
|
|
{
|
|
|
|
|
System.err.println( "File: report_ficha" + time + ".pdf - NOT DELETED" );
|
|
|
|
|
// if( !new File( "c:\\temp\\" + nome + "_" + time + ".pdf" ).delete() )
|
|
|
|
|
// {
|
|
|
|
|
// System.err.println( "File: " + nome + "_" + ".pdf - NOT DELETED" );
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
public void cleanSilentPrint()
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
System.out.println( "Not Windows" );
|
|
|
|
|
FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" );
|
|
|
|
|
fos.write( pdf );
|
|
|
|
|
fos.close();
|
|
|
|
|
System.out.println( "File saved." );
|
|
|
|
|
Process proc;
|
|
|
|
|
//System.out.println( "/usr/bin/open \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha.pdf\"" );
|
|
|
|
|
try{
|
|
|
|
|
proc = Runtime.getRuntime().exec( new String[]{"/usr/bin/open", "" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" } );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
// proc = Runtime.getRuntime().exec( "/usr/bin/open \"/Users/Shared/teste.pdf.pdf\"" );
|
|
|
|
|
}
|
|
|
|
|
proc = Runtime.getRuntime().exec( "cmd /c \"del " + System.getProperty( "user.home" ) + "\\print_fichas_temp\\*.pdf\"" );
|
|
|
|
|
proc.waitFor();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte[] createPDF( Hashtable values )
|
|
|
|
|
|