raikar_raviraj
22nd April 2009, 10:35
Hi,
I am trying to create a pdf file using ghost script writer.
.ps file is getting created but .pdf file isnt getting created.
Find below the code that i have written for the same
function create_pdf()
{
long fp1 | File to create PDF File.
string tmp.file1(1024)
| Convert file.
convert_file("POSTSCRIPT")
local.path = local.path & ".PDF"
|Create some temp files.
tmp.file1 = creat.tmp.file$( bse.tmp.dir$() )
|Open the temp files.
fp1 = seq.open(tmp.file1, "w")
| Put Ghostwriter stuff
seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE#pdfwrite", fp1)
seq.puts("-sOutputFile#"&local.path, fp1)
|seq.puts("-sPAPERSIZE=a4",fp1)
|seq.puts("-dDEVICEWIDTHPOINTS = 880",fp1)
|seq.puts("-dDEVICEHEIGHTPOINTS=1200",fp1)
|seq.puts("-sPDFPassword=baan",fp1)
seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE#pdfwrite -c save pop -sOutputFile#"&local.path & " -f " & local.path(1;(len(local.path)-3))&"ps", fp1)
| Close the files.
seq.close(fp1)
| Move these two files to the c drive.
send.report.to.client(tmp.file1, "c:\_.gs1")
|Move the postscript file to the client.
server2client( tmp.file, local.path(1;(len(local.path)-3))&"ps",1)
| Setup filename to start.
ret = rdi.domain.enum.value( "tugs",1,"2",app1,appl,fval)
ret = app_start("gswin32c.exe" & "@_.gs1", "c:\out","","","")
|ret = app_start(appl & " @_.gs1", "c:\baan\","","","")
| Make sure GS is completed before launching Acrobat.
if ret >= 0 then
| not equals
| while app_status(ret) <> 0
| suspend(500)
| endwhile
else
message("Error %d encountered while starting Ghostscript", (-1 * ret))
endif
|Delete old temp file.
ret = seq.unlink(tmp.file)
ret = seq.unlink(tmp.file1)
| Start adobe acrobat
ret = rdi.domain.enum.value( "tugs",4,"2",app1,appl,fval)
| start= "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" & " " & local.path
start= "AcroRd32.exe" & " " & local.path
| Start the aplication.
start_app()
}
I have downloaded gs863w32.exe and installed it. Have set the environment variables to point to gswin32c.exe
please let me know if any changes needs to be made in the code.
I am trying to create a pdf file using ghost script writer.
.ps file is getting created but .pdf file isnt getting created.
Find below the code that i have written for the same
function create_pdf()
{
long fp1 | File to create PDF File.
string tmp.file1(1024)
| Convert file.
convert_file("POSTSCRIPT")
local.path = local.path & ".PDF"
|Create some temp files.
tmp.file1 = creat.tmp.file$( bse.tmp.dir$() )
|Open the temp files.
fp1 = seq.open(tmp.file1, "w")
| Put Ghostwriter stuff
seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE#pdfwrite", fp1)
seq.puts("-sOutputFile#"&local.path, fp1)
|seq.puts("-sPAPERSIZE=a4",fp1)
|seq.puts("-dDEVICEWIDTHPOINTS = 880",fp1)
|seq.puts("-dDEVICEHEIGHTPOINTS=1200",fp1)
|seq.puts("-sPDFPassword=baan",fp1)
seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE#pdfwrite -c save pop -sOutputFile#"&local.path & " -f " & local.path(1;(len(local.path)-3))&"ps", fp1)
| Close the files.
seq.close(fp1)
| Move these two files to the c drive.
send.report.to.client(tmp.file1, "c:\_.gs1")
|Move the postscript file to the client.
server2client( tmp.file, local.path(1;(len(local.path)-3))&"ps",1)
| Setup filename to start.
ret = rdi.domain.enum.value( "tugs",1,"2",app1,appl,fval)
ret = app_start("gswin32c.exe" & "@_.gs1", "c:\out","","","")
|ret = app_start(appl & " @_.gs1", "c:\baan\","","","")
| Make sure GS is completed before launching Acrobat.
if ret >= 0 then
| not equals
| while app_status(ret) <> 0
| suspend(500)
| endwhile
else
message("Error %d encountered while starting Ghostscript", (-1 * ret))
endif
|Delete old temp file.
ret = seq.unlink(tmp.file)
ret = seq.unlink(tmp.file1)
| Start adobe acrobat
ret = rdi.domain.enum.value( "tugs",4,"2",app1,appl,fval)
| start= "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" & " " & local.path
start= "AcroRd32.exe" & " " & local.path
| Start the aplication.
start_app()
}
I have downloaded gs863w32.exe and installed it. Have set the environment variables to point to gswin32c.exe
please let me know if any changes needs to be made in the code.