Baanboard.com

Baanboard.com (http://www.baanboard.com/baanboard/index.php)
-   Code & Utilities (http://www.baanboard.com/baanboard/forumdisplay.php?f=33)
-   -   How to: Logos / Preprinted Forms printing (http://www.baanboard.com/baanboard/showthread.php?t=7119)

~Vamsi 11th October 2002 00:36

Logos / Preprinted Forms printing
 
Logos / Preprinted Forms in Baan

Complexity = High
This Project is Abandonware. Use at your own risk!
While a few people have been able to make it work and use it, many have questions that do not receive answers. So do not proceed any further unless you are brave.

Note that this will work only in the following environment:
  • Baan installed on Unix
  • HP or compatible printers (most laser printers are!)

Old Chinese proverb:
"Give a man a fish, and you feed him for a day.
Teach a man to fish, and you feed him for life."


So here are the various resources that help you catch your own fish :)
  • Peter Hamilton's HP PCL Laser Overlay creation utility
  • This is the software that I used from the above site
  • Improved version of Peter Hamilton's software. No binaries - you will need a compiler
  • In trying to write this document, I hit upon a goldmine. Click here, to join hpdevelopersolutions program as an affiliate member (for free ;-) Then go to developer kits, laserjets, printer languages, PCL 5 to download technical manuals

Steps to follow:
  • Download Peter Hamilton's program
  • Unzip contents into a single folder
  • Install a printer with following settings
    1. Local Printer
    2. Port = File
    3. Manufacturer = HP
    4. Printer = HP Laserjet III
    5. Name = Overlay Printer
    6. Set as Default = No
  • Create the letterhead / form in your favourite Windows program
  • Print to "Overlay Printer".
  • Save the output to "logo.prn" in the same directory that you unzipped the contents of Peter Hamilton's software
  • Open a MSDOS shell. Navigate to the directory where the program and logo.prn are located
  • execute the command "ovl logo.prn logo.ovl"
  • Open LOGO.OVL in a hex editor and traverse to the end of the file. Find the string "&f1s1x10x4X". In that string replace the last small 'x' with a capital 'X'. And the '4X' with NULs (ascii zero). So the final string should look like "&f1s1x10X<00><00>"
  • put LOGO.OVL on your Baan server, say in ${BSE}/lib/barcode/font folder
  • Modify the printer driver associated with your printers to include the following line
    Code:

    pfont14=\E&f0s1y2x1S,
  • The 1 in the 1y is the macro number, which is an option that one can specify when using ovl. The default is 1. If you choose to use a different number, make sure they are in sync
  • Do not forget the comma at the end of the line. This is very important
  • In the report that you need the logo in put the below code in the report.script
    Code:


    before.program:
            long        ret
            ret = run.prog("/usr/bin/lp", "-d" & tolower$(spool.device) &
                    " -oraw -s ${BSE}/lib/barcode/font/LOGO.OVL", RP_WAIT)

  • Create a field on the report with print expression of " ", domain tcmcs.str1 and user font 14

If you are still with us at this point, a report you print to the printer should have a logo on it.

Known issues:
At this point this does not correctly get the linespacing. I am assuming that there are linespacing commands in the generated OVL file or that it resetting the existing values to some arbitrary value. Please update this thread on how to fix that.

If you find this too complex, then go for a forms package. There are plenty of them out there. I use Streamserve. Other options like Jetform exist. The above process can be made easy by buying tools to create and generate the PCL overlay. Please use your good friend Google for that.

lvdvelde 5th August 2003 15:58

Logos / Preprinted Forms printing
 
Hey Vamsi,

I have this all working perfectly - different overlays for the first page and every next page, including logo's, header and footer.
Except for the linespacing - the Baan report has only 42 lines.

Did you learn anything yet on how to fix that?

Greetings, Lex

lvdvelde 5th August 2003 17:08

Got it!
 
Hi again,

just found out how to get the right linespacing.

In the beginning of the generated OVL file, you will find the following escape sequence:

\E&l 4d 1e (HEX 1B 26 6C 34 64 31 45)

This says: 4 lines per inch, top margin of 1 line.

When you change that to - say - 7 lines per inch, it looks a lot more like a Baan report.

\E&l 4d 1e (HEX 1B 26 6C 37 64 31 45)

Have fun!

Lex

~Vamsi 5th August 2003 18:18

Lex,

I am glad someone is using the solution. This is one thread that I contributed to Code & Utilities that never got any response :).

Could you post a sample pdf document for people to see what is possible without investing big dollars.

lvdvelde 6th August 2003 22:28

une petite erreur
 
dumdumdum...

the escape sequence for the correct linespacing should look like:

\E&l 7d 1E (HEX 1B 26 6C 37 64 31 45)

you can view the attached PDF for the result.
Header and footer including text and logos are the overlay macro, the printed data (customer address, items amounts etc.) is the Baan report data.

-- off the record - I had to construct the PDF in MS Word, because the overlay is printed as a file directly to any HP printer..... not to something like a PDF printer. But I swear our Baan output looks exactly the same! :-)

Lex

rupertb 7th August 2003 12:43

Vamsi sometimes you've just got to modify those proverbs...

Quote:

Old Chinese proverb:
"Give a man a fish, and you feed him for a day.
Teach a man to fish, and you feed him for life."

New Chinese proverb:
"Give a man a fish, and you feed him for a day.
Teach a man to fish, and you feed him for life -
Give him a rotten fish and he'll probably never bother
you again!"


Great solution - now I've got to find an application for those overlays...

Regards,
Rupert

baanbab 20th August 2003 18:56

line spacing problem
 
Hi

I tried the print a report based on vamsi's posting. It worked but I still had the line spacing problem after changing the escape sequence in OVL file.

Can you please post the OVL file which has printed with proper lince spacing.

Thanks,
Babu

~Vamsi 25th August 2003 19:00

Babu,

Please post your OVL file.

sant123 28th October 2003 07:18

Having probelm getting it to work
 
Vamsi,

I went through the same steps described in your posting, still having no luck getting it to work. one thing I noticed was I got the the error when I tried to run the statement lp -dprintque -oraw -s ${BSE}/lib/barcode/font/logo.ovl from unix shell, I got the error, I wish I could connect to office and give you the right error message, I would try that tomorrow.

we have IBM unix AIX4.3.3. Baan4c4.

all I need is to print logo on the sales invoice, your complex idea looks really good ( since i don't have to mess around with the client PCS).

One other thing, there was no folder by name fonts underneath barcode folder, all the printer drive files are under $BSE/lib/printinf/h(for hp)/ folder.

Help.

~Vamsi 28th October 2003 21:16

Quote:

lp -dprintque -oraw -s ${BSE}/lib/barcode/font/logo.ovl
That command sends the overlay to the printer. If are going to run it at the command prompt you will have to expand the environment variable ${BSE}. Make sure that the lp command for you os is what you have quoted.

sant123 4th November 2003 00:46

Problems.
 
Vamsi,

This is what I am trying to do. I would like to print invoice with the company logo on it and email it to the customers.

we have the Novell Groupwise email system, I have problem using mailx or sendmail command from AIX4.3.3 ( this is where Baan 4c4 is installed), so I gaveup on the email part. now I want atleast have the logo printed on the invoice and send the report to the Microsoft word ( Baan standard soln) and save the report on the client pc and manually e-mail it to the customer as the attachement.

I tried all the three types:

1. html format, it changes the page length, but I could use it.
2. Client side solution, ( create font and open it in BWprint ) the problem how would I email it ?? so this is not the solution.
3. your solution seems the good one, where I don't need to do anything on the client side, but if I send it to the word document does it still add the logo to the report.

Thanks for any help.

also the error I get when I do lp -d the error is as follows.

0782-040 Cannot open print file.
The file name is raw
The errno (error number) from the open system call is 2
Check the file name specified with your print request.
<EOT>

~Vamsi 4th November 2003 01:27

You left me boggled. I am not sure I understand if you want to print the invoice or email it.

This solution works as follows:
- An overlay of the logo is created
- This is then transferred to the printer
- A standard Baan report is printed to this printer with code to activate the overlay. In effect printing the logo on the invoice.

You can then *mail* this invoice to the customer, but not *email* it.

What part of the above is causing a problem? If you want to talk about this solution send me an email and I will send you my phone number.

If you are creative you can use the Vanilla PDF solution I posted in this forum to generate PDF, overlay a logo on each page and email the resulting file. Sounds complex - perhaps it is.

For an out of box solution to add a logo to an invoice and then email it in a single step, look to www.nazdaq.co.il.

sant123 4th November 2003 06:20

Boy did I messup!!!!
 
I tried to give as much details possible and made it quite complicated.

I understand your solution creates the print file with the overlay logo, but could not be used as the attachement that could be sent as an email.

I would try to look into the PDF creation tool.

I would still email you to get the overlay print problem solved. I didn't get the logo printed, I used the User Font 13 in my case since 14 is already used for some other report. couldn't get it to work.

Thanks.
Sant.

shah_bs 18th March 2004 20:50

${BSE} does not expand
 
Hello people.

This is under BAAN IVc3 and HPUX: I found that, the command as suggested for the report script does not expand the ${BSE}. So, here is what I did:

Code:

before.program:
        domain  tcmcs.long      p.ret.c
        domain  tcstr.128.c    p.command.c

        p.command.c = "-d"
                      & tolower$(spool.device)
                      & " -oraw -s "
                      & bse.dir$()
                      & "/lib/barcode/font/LOGO.OVL"

        p.ret.c = run.prog(
                        "/usr/bin/lp",
                        p.command.c,
                        RP_WAIT)

And that worked.

~Vamsi 18th March 2004 23:14

Shah could you please improve the documentation based on your experience. Either use this thread or start your own in Wiki.


All times are GMT +2. The time now is 18:02.


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