I have the following toy program which I would expect to transform my spool
files on our V6R1 host to PDF (just an example) and give me the bytes of the
PDF file as a PrintObjectTransformedInputStream. Unfortunately it fails
with



Exception in thread "main" com.ibm.as400.access.AS400Exception: CPF6DF4
Object QCTXPDF in library QSYS contains unrecognizable data.

at
com.ibm.as400.access.NPConversation.makeRequest(NPConversation.java:163)

at
com.ibm.as400.access.PrintObjectTransformedInputStreamImplRemote.createPrint
ObjectTransformedInputStream(PrintObjectTransformedInputStreamImplRemote.jav
a:211)

at
com.ibm.as400.access.PrintObjectTransformedInputStream.<init>(PrintObjectTra
nsformedInputStream.java:78)

at
com.ibm.as400.access.SpooledFile.getTransformedInputStream(SpooledFile.java:
772)

at
com.ibm.as400.access.SpoolFileTransformerExample.main(SpoolFileTransformerEx
ample.java:37)



To run the program as-is, create ?axs.properties? in your home directory ?
sample content:



as400.user=tra

as400.password=?

as400.hostname=hostname



I have verified the other day that the system can use the ?override
printerdefintion to capture print from job into a PDF stream file? trick, so
the mechanism is in place.



Suggestions on where to look or what I have missed? We are up to date on
PTFs etc. I am using jtopen-5.0 from Maven central (if that should matter).







package com.ibm.as400.access;



import java.io.File;

import java.io.FileInputStream;

import java.io.InputStreamReader;

import java.util.Enumeration;

import java.util.Properties;



public class SpoolFileTransformerExample {



public static void main(String[] args) throws
Exception {

Properties p = new
Properties();

FileInputStream
inStream = new FileInputStream(new File(


System.getProperty("user.home"), "axs.properties"));

p.load(inStream);

inStream.close();



AS400 as400 = new
AS400(p.getProperty("as400.hostname"),


p.getProperty("as400.user"), p.getProperty("as400.password"));



SpooledFileList
spooledFileList = new SpooledFileList(as400);


spooledFileList.setQueueFilter("/QSYS.LIB/%ALL%.LIB/%ALL%.OUTQ");


spooledFileList.setUserFilter("*CURRENT");


spooledFileList.openSynchronously();




@SuppressWarnings("unchecked")


Enumeration<SpooledFile> e = spooledFileList.getObjects();



while
(e.hasMoreElements()) {


SpooledFile spooledFile = e.nextElement();


PrintParameterList plist = new PrintParameterList();


plist.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT,


"/QSYS.LIB/QCTXPDF.WSCST");


plist.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST");




PrintObjectTransformedInputStream potis = spooledFile


.getTransformedInputStream(plist);




InputStreamReader ctr = new InputStreamReader(potis);


int ch;


while ((ch = ctr.read()) != -1) {


System.out.print((char) ch);


}


System.out.println("");


ctr.close();

}


spooledFileList.close();


as400.disconnectAllServices();

}

}








As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2021 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.