× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



When you get time do a search in the archives for this thread "Printing
GIF with AFPDS printer file"
There is a lot of information in this subject. Please know that this
information was when we were on 7.1, apparently 7.2 resolved all the work
around stuff I did. Here is what I wrote up... Around step 6 is the part
you would be mostly interested in.


Good news. After getting the QimgCvtImg api to work using a stream file. I
thought I may be out of luck. But I was able to successfully get what I
needed.

During this process, I read up on the AFPRSC printer file keyword. I first
started out using that. The problem was that the printers wouldn't print
the image that I've put on the spool file. I was expecting it work
basically like and image.

Since it wouldn't print from the original AFPDS spool file, I tried to
override the printer file so that it would create a PDF on the IFS. When I
opened the PDF or printed, the image was there. So great I was almost
there.

After that I fought for several days with trying to get the GIF image on a
printer file (QSYSPRT) overridden to DEVTYPE(*USERACSII). I was able to
successfully get the image to print, but I had no control on where it
printer, nor the size of it.

Then it hit me this morning. The QimgCvtImg api is able to convert PDF
stream files to a spool file. So I gave it shot and was able to get my
packing slip exactly how I need it.

The steps needed for others in the future when getting a base64 encoded
image from a webservice.

1. Get the GIF from UPS by initiating the call to the webservice.
2. parse the base64 string from the XML data (or whatever datasource) .
3. Use Apr_Base64_Decode_Binary (apache's base64 program).
-- binary_length = Apr_Base64_Decode_Binary(binaryImage:LabelImage);
//LabelImage is base64, the input parm. binaryImage is the output
converted string.
4. Converted the Source CCSID of 1208 to 500 using QtqIconvOpen, iconv,
iconv_close procedures.
5. Wrote the binary string field to the IFS using Scott Klements IFS
procedures.
fd = open('/home/xxxxxxxxxx/testups.gif'
: O_WRONLY + O_CREAT + O_TRUNC
: S_IRUSR + S_IWUSR + S_IRGRP);
callp write(fd: %addr(binaryimage): %len(%Trim(binaryimage)));
callp close(fd);
6. Override packing slip printer file.
OVRPRTF TESTUPS DEVTYPE(*AFPDS) OUTQ(QPRINTS) PAGESIZE(66 85)
TOSTMF(''/home/xxxxxxxxxx/test1.pdf'') WSCST(*PDF)');
7. Opened printer file for packing slip. Add information to print, and set
image in proper place using program to system fields.
Rotate = 0;
// How far down the page.
POSD = 6.5;
// How far across the page
POSA = 1.25;
// Width of the image
WIDTH = 8;
// Height of the image
HEIGHT = 4;
// Name of Object on IFS. WITHOUT THE PATH
OBJNAME = testups.gif;
// Path to the Object
PATH = '/home/xxxxxxxxxx/';
Write REC1; // Put image on page.
7.A. The REC1 definition.
A R REC1 AFPRSC(&OBJNAME 22 +
A &POSD &POSA +
A (*SIZE &WIDTH &HEIGHT) +
A (*ROTATION &ROTATE) +
A (*MAPOPT *SL) +
A (*PATH &PATH) +
A )
A ROTATE 3S 0P
A POSD 5S 3P
A POSA 5S 3P
A WIDTH 5S 3P
A HEIGHT 5S 3P
A OBJNAME 125A P
A PATH 500A P

8. Override QSYSPRT as device type of *USERASCII
OVRPRTF QSYSPRT DEVTYPE(*USERASCII) // there is no opening of this
file. QimgCvtImg will create it.
9. Call QimgCvtImg after setting up the datastructures to pass to it. Code
example found here. http://code.midrange.com/0452359861.html
10. Delete override on both printer files.
11. Printer file created in QimgCvtImg prints with image on it!!!!!


On Thu, Apr 18, 2019 at 2:09 PM Michael Schutte <mschutte369@xxxxxxxxx>
wrote:

Yes I have, I believe I put the code out on code.midrange.com somewhere.
I will try to find it. It may not be the best solution but it was what I
could get to work.

On Thu, Apr 18, 2019 at 12:15 PM Jeff Bianchi <Jeff.Bianchi@xxxxxxxx>
wrote:

Hello,

Does anyone have a working example (printer file and RPGLE source code)
of their use of the AFPRSC format keyword for AFPDS printer files?

I'd like to see any working examples so I can understand how to use this
keyword. My specific needs are surrounding a multipage TIFF image, but
again I'd like to see ANY working examples.

Thanks!




Jeff Bianchi

Jeff.Bianchi@xxxxxxxx<mailto:Jeff.Bianchi@xxxxxxxx>| P 253.804.1034
Oak Harbor Freight Lines, Inc.
"Bringing Peace of Mind Since 1916."

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.