Abuibra
12th June 2002, 09:04
Is it possible to print a BaaN Report to an Acrobat file just like when you print to excel?

lli-baan
12th June 2002, 09:29
1. You can write a script for converting the pcl-File (tmp-File) into PDF. For this action you need the software pcl2pdf from http://www.visual.co.uk
2. If your users work with windows-clients, then you can use the freeware Ghostscript. You will find it under http://http://www.ghostscript.com/
Here is the script for version 2 (it works on our machine). You have the add an Device:
|****************************** DECLARATION SECTION ***************************
long ret
string tmp.file(1024),local.path(100),ghostscript.path(100)

#pragma used dll "ottdllbw"
#pragma used dll "ottdllinputstr"
#pragma nowarnings

|****************************** FUNCTION SECTION ***************************
function main()
{
long i
tmp.file = creat.tmp.file$(bse.tmp.dir$())
wait.and.activate("ttstpconv",argv$(1),tmp.file,argv$(3),argv$(4))
local.path = argv$(2)
if not job.process then
while rpos(toupper$(local.path), ".PDF") <> (len(local.path)-3)
ret=input.string("Destination", "extension should be .pdf",100,50,local.path)
endwhile
endif
for i = 1 to len(local.path)
if local.path(i; 1) = "/" then
local.path(i; 1) = "\"
endif
endfor

make.pdf()
ret = seq.unlink(tmp.file)
}

function make.pdf()
{
long fp1
long fp2
string tmp.file1(1024)

ghostscript.path = "c:\ghost\gs6.50\bin\gswin32c.exe"
tmp.file1 = creat.tmp.file$(bse.tmp.dir$())
fp1 = seq.open(tmp.file1, "w+")

seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite", fp1)
seq.puts("-sOutputFile="&local.path&" -sPAPERSIZE=a4", fp1)
seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -c save pop -sOutputFile="&
local.path & " -f " & local.path(1;(len(local.path)-3))&"ps", fp1)

seq.close(fp1)
create.local.directory("c:\temp\")
server2client(tmp.file1, "c:\temp\conv_instr", 1)
server2client(tmp.file, "c:\temp\" & local.path(1;(len(local.path)-3)) &
"ps", 1)
ret = app_start(ghostscript.path&" "&"@conv_instr", "c:\temp\", "", "", "")
suspend(2000)

ret = app_start(local.path, "c:\temp\", "", "", "")
remove.local.file ("c:\temp\" & local.path(1; (len(local.path)-3))&"ps")
remove.local.file ("c:\temp\conv_instr")
ret = seq.unlink(tmp.file1)
return
}
|********************************** End of File *******************************

Karin Br.
12th June 2002, 09:53
We print our Baan-reports to a postscript-printer and then convert this file to PDF via Acrobat Distiller. That works very fine.

~Vamsi
12th June 2002, 10:12
Hi,

I am the original author of the code posted above :). You can find the original code and modifications by one of our other moderators in this thread: http://www.baanboard.com/baanboard/showthread.php?s=&threadid=590

lli-baan
12th June 2002, 11:40
YOU are the original author? I've got it from my Development Trainer!!!