Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > Code & Utilities

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #16  
Old 24th August 2005, 06:41
~Vamsi's Avatar
~Vamsi ~Vamsi is offline
Guru
 
Join Date: Aug 2001
Location: San Diego CA, USA
Posts: 590
~Vamsi will become famous soon enough
Baan: ~*~ - DB: ~*~ - OS: ~*~
Manoj,

Please accept my apologies in not being of much assistance in the matter. When it comes to Java I am a complete novice. It took me days of perseverence to figure out the classpath stuff when I was experimenting with http://www.antlr.org/

And from first looks at the problem it looks like a Classpath issue. Hopefully someone can help you with what needs to be set in the classpath variable. If you are researching yourself, I liked this page that comes very high in a google search - http://www.kevinboone.com/classpath.html
__________________
~Vamsi
Vamsi Potluru
Baan XL Yet another tool to format Baan output in Excel from Baan Board
This one just happens to be free :)

Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #17  
Old 24th August 2005, 08:51
veyant veyant is offline
Senior Member
 
Join Date: May 2003
Location: Gurgaon
Posts: 107
veyant is on a distinguished road
Baan: Baan IV/V - DB: Oracle - OS: Unix/AIX
thanks. problem resoved

Hi,

Thanks to all for the support. The Program has been sorted out. it was not because of CLASS PATH at all. Actually, it was throwing some exception s while running convertion script due to footer & logo which is embedded in the script. after commenting the lines due to which exception msg was comming , problem has been resolnved and has been implemented successfully on Baan IVc4.
__________________
veyant
Reply With Quote
  #18  
Old 24th August 2005, 10:13
manojsharma's Avatar
manojsharma manojsharma is offline
Senior Member
 
Join Date: Sep 2002
Location: Delhi
Posts: 200
manojsharma is on a distinguished road
Baan: 4C4, 5, Baan LN - DB: Oracle,informix - OS: Unix, NT, Windows-2000
Thumbs up thanx

Thanx Akshay, Vamsi for your prompt reply. My problem solved. I was facing the same problem as veyant is facing

Thanx all.

Its a nice utility
__________________
Together we can and we will make a difference
Reply With Quote
Sponsored Links
  #19  
Old 14th December 2005, 07:36
deepaksachdeva's Avatar
deepaksachdeva deepaksachdeva is offline
Senior Member
 
Join Date: Jan 2003
Location: Mumbai
Posts: 151
deepaksachdeva is on a distinguished road
Baan: B IV c4, ERP Ln 6.1, Webtop - DB: Oracle , MS Sql Server 2000 - OS: IBM AIX 5.3,windows 2000
I had tried the same, but finding one error while executing print, can not read session or object tdapbpdf, i had made tdapbpdf as 3 gl prgram.

could any one help me out where i am lacking.

Regards
Deepak
Reply With Quote
  #20  
Old 14th December 2005, 14:05
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 6,905
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
I think it should be otdapbpdf in the device program - try that.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #21  
Old 15th December 2005, 07:08
deepaksachdeva's Avatar
deepaksachdeva deepaksachdeva is offline
Senior Member
 
Join Date: Jan 2003
Location: Mumbai
Posts: 151
deepaksachdeva is on a distinguished road
Baan: B IV c4, ERP Ln 6.1, Webtop - DB: Oracle , MS Sql Server 2000 - OS: IBM AIX 5.3,windows 2000
Hi Manoj,

could u please explain me the procedure, how u have mangaged to do this, we are also on the same platform as u are.

Thanks Mark, your suggession for otdapbpdf has worked, but i m facing the problem which manoj has faced earlier.

with Regards
Deepak

Last edited by deepaksachdeva : 15th December 2005 at 10:09.
Reply With Quote
  #22  
Old 15th December 2005, 09:25
manojsharma's Avatar
manojsharma manojsharma is offline
Senior Member
 
Join Date: Sep 2002
Location: Delhi
Posts: 200
manojsharma is on a distinguished road
Baan: 4C4, 5, Baan LN - DB: Oracle,informix - OS: Unix, NT, Windows-2000
Hi

Hi Deepak,

I was facing problem in tcd_text2pdf file, just remove the lines which print logo and footer (e-mail etc.) from your script and it will work fine.
__________________
Together we can and we will make a difference
Reply With Quote
  #23  
Old 15th December 2005, 10:13
deepaksachdeva's Avatar
deepaksachdeva deepaksachdeva is offline
Senior Member
 
Join Date: Jan 2003
Location: Mumbai
Posts: 151
deepaksachdeva is on a distinguished road
Baan: B IV c4, ERP Ln 6.1, Webtop - DB: Oracle , MS Sql Server 2000 - OS: IBM AIX 5.3,windows 2000
I had removed the logo and footer, but while running the file by using java tcd_text2pdf <inputfile> <outputfile> <pagelength> it is throwing following error :

# java tcd_text2pdf pdf.sh deepak.pdf
The java class could not be loaded. java.lang.ClassFormatError: tcd_text2pdf (Ba
d magic number)

can someone help me out on this.

With Regards
Deepak
Reply With Quote
  #24  
Old 16th February 2006, 11:21
deepaksachdeva's Avatar
deepaksachdeva deepaksachdeva is offline
Senior Member
 
Join Date: Jan 2003
Location: Mumbai
Posts: 151
deepaksachdeva is on a distinguished road
Baan: B IV c4, ERP Ln 6.1, Webtop - DB: Oracle , MS Sql Server 2000 - OS: IBM AIX 5.3,windows 2000
hi

hi akshay,

i m facing the problem while applying your solution, i had debugged it and found there is a problem in running the program.

could u pls help me out where i m wrong ?

Deepak
Attached Images
File Type: jpg error.JPG (66.6 KB, 53 views)
Reply With Quote
  #25  
Old 1st March 2006, 22:33
awassif awassif is offline
Junior Member
 
Join Date: Jun 2003
Posts: 5
awassif is on a distinguished road
Question Error: "Bad magic number"

Hi Deepak,
I am having the same problem. When I execute from command line I get (Bad magic number) error:
# /usr/java14/bin/java -cp ./itext-1.3.jar tcd_text2pdf.class test test.pdf

Error:
====
The java class could not be loaded. java.lang.ClassFormatError: tcd_text2pdf (Bad magic number)

Any one can help would be appreciated.
- Ameen
Reply With Quote
  #26  
Old 21st March 2006, 08:54
camilla camilla is offline
Junior Member
 
Join Date: Jul 2004
Posts: 14
camilla is on a distinguished road
Baan: LN FP7 - DB: Microsoft SQL Server - OS: Windows
Also I had the same error: any suggestion?

Hi, I had the same error:
bad magic number
I search in Internet and I think that the problem is that the files are not compiled with the right version of java. Is it the problem? Can someone help me?
Attached Images
File Type: jpg telnet.jpg (85.2 KB, 15 views)
Reply With Quote
  #27  
Old 22nd March 2006, 07:58
camilla camilla is offline
Junior Member
 
Join Date: Jul 2004
Posts: 14
camilla is on a distinguished road
Baan: LN FP7 - DB: Microsoft SQL Server - OS: Windows
I solved the problem of bad magic number!

Hi,
I compiled the java class tcd_text2pdf and everything now works fine!
You have to rename the file tcd_text2pdf in tcd_text2pdf.java; then you can directly use the file pdf.sh to compile it, only making two step:

1) modify the file pdh.sh:
instead of java you have to write:
javac tcd_text2pdf.java $@
2) download from the iText site the not compiled library, unzip the file and copy as bin the files on the unix folder where you have pdf.sh

then you have to execute pdh.sh, by the unix prompt:
./pdf.sh

That's all!

The compiler will create to you a file: tcd_text2pdf.class

Then you have to modify again the file pdf.sh and put it as before.

Ciao
Cri
Reply With Quote
  #28  
Old 14th November 2006, 08:28
mr_suleyman's Avatar
mr_suleyman mr_suleyman is offline
Guru
 
Join Date: Aug 2004
Posts: 639
mr_suleyman is an unknown quantity at this point
Baan: Baan IV - DB: Oracle - OS: HP UX, IBM AIX
It doesnt' work for me . I got some errors about JAVA code. I removed some lines from it.I compiled but I couldn't get PDF file.
Quote:
WHO do you know all about it ?

Thanks ...
Reply With Quote
  #29  
Old 26th June 2010, 13:16
jmathew jmathew is offline
Senior Member
 
Join Date: Aug 2003
Location: Middle East
Posts: 183
jmathew is on a distinguished road
Baan: Baan IV C4 - DB: Oracle 8i - OS: Windows 2000
Hi Akshay,
Can you please help us how we could implement the same with Baan LN 6.1 FP5. The operating system is AIX 5.3. and the database is Oracle 9.2. Please let us know the steps in details. Thanks in advance.


Quote:
Originally Posted by ahulikavi View Post
Hi,

3 components are required

1. Baan 3GL to convert report to ASCII and invoke shell scripts
2. Java Class to convert text to pdf
3. Shell scripts to invoke java class
4. Device Definition

1. Baan 3GL - Hope copyright is OK

Code:
||******************************************************************************
|* tdtcdpdf	0  VRC B40C L ive		
|* Title	: PDF
|* Author	: Akshay Hulikavi
|* Date		: 2004-02-09 [09:17]
|******************************************************************************
|* License	:
|* Copyright 2004 by Akshay Hulikavi
|* 
|* All Rights Reserved 
|* 
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation. 
|* 
|* Akshay Hulikavi DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL Akshay Hulikavi BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|******************************************************************************
	#pragma used dll ottdllbw
	
	long		ret, fp, zoomed	| general return variable
	extern	domain	tcmcs.str215	input.file, pdf.file, local.file	| input file - created by Baan
	extern	domain	tcmcs.str215	argument, argu1, argu4, argu0, argu2, argu3
	extern	domain	tcmcs.str215	argu5, argu6, argu7, argu8, argu9
	extern string	sh.string(1024), file.path(128), date.str(8), time.str(5), dat(12)

function main()
{
 	argu0 = argv$(0)
 	argu1 = argv$(1)
 	argu2 = argv$(2)
 	argu3 = argv$(3)
	argu4 = argv$(4)
	zoomed = false

	dat = dte$()
	date.str = dat(3;2) & "/" & dat(1;2)& "/" & dat(5;2)
	time.str = dat(7;2) & ":" & dat(9;2)
	
	if argu1 = "" and argu2= "" then	| Called from another program not spooler
	    import("argu1", argu1)
	    import("argu2", argu2)
	    import("argu3", argu3)
	    import("argu4", argu4)
	    zoomed = true
	endif    
	    
	file.path = getcwd()
 	input.file = shiftl$(strip$(argu2))
	ret = wait.and.activate("ttstpconv", argu1, input.file, "ASCII", "wt")


	input.file = shiftl$(strip$(file.path))&"/"&shiftl$(strip$(input.file))
	pdf.file = input.file&".pdf"
	local.file = "c:\"&shiftl$(strip$(argu2))&".pdf"

	sh.string = ""
	sh.string = sh.string &" "&chr$(34)&input.file&chr$(34)
	sh.string = sh.string &" "&chr$(34)&pdf.file&chr$(34)
	sh.string = sh.string &" "&str$(spool.pg.length)
	sh.string = sh.string &" "&chr$(34)&logname$&" on "& date.str & " at "& time.str& chr$(34)

	fp=seq.open("text2pdf.sh","r")	
	if fp >= 1 then | text2pdf.sh file exists
		ret = shell( "text2pdf.sh " & sh.string,0)
	else	
		fp=seq.open("text2pdf.sh","wt")	
		seq.puts("cd /baanIVc/c4/bse/tcd_email", fp)
		seq.puts("pdf.sh $@", fp)
		seq.close(fp)
		ret = shell( "chmod 777 text2pdf.sh",0)
		ret = shell( "text2pdf.sh " & sh.string,0)
	endif	

	if ret = 0 then
		if zoomed = false then	| Called from another program not report
			ret =  server2client(pdf.file,local.file,  0, 0)  | Binary Mode Transfer
			if ret = 0 then
				ret =  app_start(local.file,"","","","")
				ret = seq.unlink(input.file)
				ret = seq.unlink(pdf.file)
			else	
				message("File could sent to client !!!!" & str$(ret)&local.file)
			endif	
		endif	
	else
		message("File could not be created !!!!" & str$(ret))
	endif	

}
|*********************************** end of script ****************************



2. the java class tcd_text2pdf
Code:
/*
Class to convert baan ascii report to pdf
Author : Akshay Hulikavi
Date    : 10.02.2004

Requires : itext-x.jar - can be downloaded from <a href="http://www.lowagie.com/iText/" target="_blank">www.lowagie.com/iText/</a>
Source can be downloaded from <a href="http://www.lowagie.com/iText/" target="_blank">www.lowagie.com/iText/</a>

Usage : java tcd_text2pdf  <inputfile> <outputfile.pdf> <PageLength, Default = 60>

*/
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
import java.io.*;

public class tcd_text2pdf 
{

public static void main(String[] args)
         throws IOException, DocumentException
	{
	String resultStr = "", line=null, strFooter; 
	int lncnt=1, i, j, pgcnt=0, fntSize=8, lineSpacing, strLength=0;	

	//~ i = Integer.parseInt(args[2]);
	j = Integer.valueOf(args[2]).intValue();
		if (j <= 0)
			j = 60;  // Default page length

		if(args.length < 2 ) {
			System.out.println("Usage : java tcd_text2pdf  <inputfile> <outputfile.pdf> <PageLength, Default = 60>"); 
			return;	
		}	
	
	Reader in = new InputStreamReader(new FileInputStream(args[0]));
	OutputStream os = new FileOutputStream(args[1]);
	Document doc= new Document();
	Image t_logo = Image.getInstance("logocolor.jpg");
	t_logo.scalePercent(75);  // scale image to 75%
	java.io.BufferedReader  br2  = new java.io.BufferedReader(in);   

	// get length of the longest line 	
		try { 
		    BufferedReader bufReader = new BufferedReader(new FileReader(args[0])); 
		    while ((line=bufReader.readLine()) != null){ 
					if (strLength < line.length())
						strLength = line.length();
				}
		    bufReader.close(); 
		
		} catch (IOException e) { 
		    System.err.println(e); 
		}



	line = null;		
		i=1;

/*
	Decide on Paper Size ,Orientation and Line Spacing based on max line length in report
	
*/
		if (strLength <= 108)
			i = 1 ;	
		if (strLength > 108 && strLength <= 127)
			i = 2 ;	
		if (strLength > 127 && strLength <= 165)
			i = 3 ;	
		if (strLength > 165 && strLength <= 176)
			i = 4 ;	
		if (strLength > 176 && strLength <= 239)
			i = 5;	
		if (strLength > 239)
			i = 6 ;	
			
	 switch (i) { 
			case 1: 
				doc = new Document(PageSize.A4, 36, 18, 72, 18); 
				fntSize = 8;
				lineSpacing = fntSize;
				t_logo.setAbsolutePosition(535, 770);  // image margin 60 so 595-60 and 842-60
			break; 		
			case 2: 
				doc = new Document(PageSize.A4, 36, 18, 72, 18); 
				fntSize = 7;
				lineSpacing = 9;
				t_logo.setAbsolutePosition(535, 770);  
			break;		
			case 3:
				doc = new Document(PageSize.A4.rotate(), 36, 18, 72, 18); 
				fntSize = 8;
				lineSpacing = fntSize;
				t_logo.setAbsolutePosition(770, 535);  
			break; 
			case 4:
				doc = new Document(PageSize.A4.rotate(), 36, 18, 72, 18); 
				fntSize = 7;
				lineSpacing = 9;
				t_logo.setAbsolutePosition(770, 535);  
			break;
			case 5:
				doc = new Document(PageSize.LEDGER, 36, 18, 72, 18); 
				fntSize = 8;
				lineSpacing = fntSize;
				t_logo.setAbsolutePosition(1164, 732);  
			break;
			case 6:
				doc = new Document(PageSize.LEDGER, 36, 18, 72, 18); 
				fntSize = 7;
				lineSpacing = 9;
				t_logo.setAbsolutePosition(1164, 732);  
			break;
			default:
				doc = new Document(PageSize.A4, 36, 36, 72, 18); 
				fntSize = 8;
				lineSpacing = fntSize;
				t_logo.setAbsolutePosition(535, 770);  // image margin 85 so 595-85 and 842-85
			break;		

			} 
	
	
	// Add footer
	strFooter   = "Thermax Limited Chemical Division : 97-E General Block MIDC Bhosari Pune 411026";
	strFooter +="\nPhone - 91-20-27120181, Fax - 91-20-27120206, URL - <a href="http://www.thermaxindia.com/chemical" target="_blank">www.thermaxindia.com/chemical</a>";
	strFooter +="\nGenerated by (BaaN Login) : ";
	strFooter +=args[3];
	
	HeaderFooter footer = new HeaderFooter(new Phrase(strFooter,FontFactory.getFont(FontFactory.COURIER, 7)), false);
	
	PdfWriter docWriter = null;
	docWriter = PdfWriter.getInstance(doc, os);
        doc.setFooter(footer);
	docWriter.setEncryption(PdfWriter.STRENGTH40BITS, null, null,  PdfWriter.AllowPrinting);
	doc.addTitle("BaaN Report");
	doc.addSubject("Report Generated from BaaN System");
	doc.addKeywords("Thermax Limited Chemical Division : 97-E General Block MIDC Bhosari Pune 411026");
		
	doc.open();
            doc.add(t_logo);
	Paragraph p;
	java.io.BufferedReader  br  = new java.io.BufferedReader(in);   

	try 	{ 
		while ((line=br.readLine()) != null){ 
			if (lncnt > j)
			{	
				doc.newPage();
				lncnt = 0;
			}	
			p = new Paragraph(new Phrase(lineSpacing,line,FontFactory.getFont(FontFactory.COURIER, fntSize)));
			doc.add(p);
			lncnt++;	
			}
			br.close();
		} catch (IOException e) { 
			System.out.println("IO Exception on Buffered Read :" + e); 
		}; 
	
	doc.close();
	os.close();
}

}


3. Shell Scripts
a. text2pdf.sh in user home directory
Code:
cd /baanIVc/c4/bse/tcd_email
pdf.sh $@
b. pdf.sh in say $BSE or other convinient directory
Code:
CLASSPATH=.:/baanIVc/c4/bse/tcd_email/PeBSClasses.zip:/baanIVc/c4/bse/tcd_email/itext-1.01.jar:/usr/j2se/javamail/javamail-1.3/mail.
export CLASSPATH
java tcd_text2pdf $@

4. Device Definition
Also need to define device called say PDF as follows

Device type: Rewrite File
4GL Program : tdtcdpdf
Argument : %s
Page Length : 72



regards
__________________
Regards,
John.
Reply With Quote
  #30  
Old 4th August 2011, 16:35
lchleong lchleong is offline
Junior Member
 
Join Date: Nov 2010
Posts: 5
lchleong is on a distinguished road
Baan: 3 - DB: Oracle - OS: Linux
Great idea. It works perfectly. But how do I draw lines or tables that i had drawn in LN report into PDF. Apparently, all the horizontal lines had been converted into dashed lines instead of straight lines.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DEV: Create vanilla PDF files from Baan with Open Source components ~Vamsi Code & Utilities 69 3rd August 2011 08:04
DEV: Create vanilla PDF files from Baan with Open Source components Eddie Monster Tools Development 7 17th December 2001 18:41


All times are GMT +2. The time now is 08:41.


©2001-2017 - Baanboard.com - Baanforums.com