Midrange News for the IBM i Community


Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Chicagoland
Print BMP with DDS
has no ratings.
Published: 24 Jun 2013
Revised: 27 Jun 2013 - 1365 days ago
Last viewed on: 22 Mar 2017 (3226 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Print BMP with DDS Published by: Bob Cozzi on 24 Jun 2013 view comments(4)

I have a requirement from a client to print a Signature Captured from a Topaz device.

The requirement is to send the printed document (a receipt with the signature on it) to a PDF file and store it on the IFS.

Here is what I know:

  1. How to print it from the system directly to the printer
  2. How to print the receipt
  3. How to copy a SPOOL file to PDF

However, sending a BMP to a SPOOL file in native (EPSON in this case) printer language doesn't convert to PDF using the IBM utilities.

So I'm wondering how to embed a BMP dynamically into a output SPOOL file so that it could then be copied to PDF using the built-in PDF support in IBM i.

Any suggestions?

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: clbirk
Premium member *
Comment on: Print BMP with DDS
Posted: 3 years 8 months 28 days 23 hours 8 minutes ago

Have you thought about doing it in php?

You have this signature in a bitmap file located on the IFS? I assume this is some sort of interactive job where the customer is selecting the signature the need printed. Does it make sense to open it up in a browser (like rpg to desktop)?

Let me describe a similar project that I do, and maybe it might help.  We get in pdf's  that are packing slips that we have to print out and put in the box on one customer. What I do is I call aaron bartell's (mowyourlawn.com) rpg2desktop from rpg and I have the pdf's located on a "windows" file server (could be the ifs if it is mapped drive), and that opens the pdf, and use a pdf wrapper prints the pdf, etc.  (no php involved), but I wonder about using similar stuff to call a php command to take the bmp and make the pdf and put resultant pdf in the IFS and bypass the "spool file to pdf conversion".

 

chris

 

 

 

Posted by: tdaly
Premium member *
Comment on: Print BMP with DDS
Posted: 3 years 8 months 26 days 23 hours 3 minutes ago
Edited: Wed, 26 Jun, 2013 at 16:01:24 (1366 days ago)

If you could convert the BMP into an AFP PAGSEG you could include the image with the AFPRSC DDS keyword.

Create the PAGSEG by printing to a file with the AFP print driver included with cllient access. Then IIRC upload the file and use the CRTPAGSEG cmd.

The trick will be automating the conversion. Maybe an approach would be to pre-create the PAGSEGs before calling the print pgm, keep track of their names or have a naming convention so the correct PAGSEG can be referenced on demand by the print program.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Print BMP with DDS
Posted: 3 years 8 months 26 days 15 hours 38 minutes ago

Tom, that's an interesting option. I've done that before with Logos and whatnot.

I'm wondering this...

i will with say "10,000" BMPs to be printed along with their invoices. This would be signatures captured during a sale.

Could I some how, generate an OVL or the PAGSEG using an API or CL command "on the fly" and then override the print file or pass that OVL name to the program/print-file at runtime? Since I can convert AFP to PDF using the system functions, it would be likely that an AFP generated SPOOL file would convert properly.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Print BMP with DDS
Posted: 3 years 8 months 26 days 7 hours 44 minutes ago
Edited: Thu, 27 Jun, 2013 at 07:20:50 (1365 days ago)

I started going down the AFPRSC keyword route one time for a logo. The problem is that BMP is not a supported file type. JFIF (aka JPG) and TIFF are.

My plan was to use Convert Image (QIMGCVTI, QimgCvtImg) API to convert the BMP to AFP, which I hoped would be compatible with either *GOCA or *IOCA on the AFPRSC() keyword. Wouldn't take a lot of experimentation to answer that question.

Unfortunately, I ultimately wound up using the Windows AFP printer driver, upload, etc., to convert my logo to an *OVL. I abandoned the convert image and AFPRSC() path, and never had a reason to go back to it, so I can't offer any sample code for you.

If you do try this, I suggest using AFPRSC to reference a JPG (*JFIF) as a stream file (any JPG of the appropriate size should do), and make sure that works with your conversion of spooled file to PDF, before attempting to add the convert image API.