no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@220 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 20 years ago
parent 410a8ddad4
commit ad725d6541

@ -167,45 +167,37 @@ public class ExamePDF {
if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) if( System.getProperty( "os.name" ).startsWith( "Windows" ) )
{ {
System.out.println( "Windows" );
Process proc; 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.write( pdf );
fos.close(); fos.close();
System.out.println( "File saved." ); 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 + "\""); //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( "cmd /c \"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",
// proc = Runtime.getRuntime().exec( "cmd /c \"acrord32.lnk /t " + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf " + printerName + "\"" ); // System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf",
// proc = Runtime.getRuntime().exec( "cmd /c dir" ); // printerName });
proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat",
"c:\\temp\\" + nome + "_" + time + ".pdf",
printerName });
proc.waitFor(); proc.waitFor();
if( !new File( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" ).delete() ) // if( !new File( "c:\\temp\\" + nome + "_" + time + ".pdf" ).delete() )
{ // {
System.err.println( "File: report_ficha" + time + ".pdf - NOT DELETED" ); // System.err.println( "File: " + nome + "_" + ".pdf - NOT DELETED" );
} // }
}
else
{
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\"" );
} }
} }
public void cleanSilentPrint()
throws Exception
{
Process proc;
proc = Runtime.getRuntime().exec( "cmd /c \"del " + System.getProperty( "user.home" ) + "\\print_fichas_temp\\*.pdf\"" );
proc.waitFor();
}
public byte[] createPDF( Hashtable values ) public byte[] createPDF( Hashtable values )
{ {
Document document = new Document(); Document document = new Document();

Loading…
Cancel
Save