×
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.
Looks like I need to read up on this IOCA thing :)
I'll report back if I ever get this to work :-S
Thanks again,
/Thorbjørn
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dan Kimmel
Sent: 13. januar 2011 15:10
To: Java Programming on and around the IBM i
Subject: RE: Printing MO:DCA P documents from Java?
I wrote this in RPG, more as an exercise to refresh my RPG skills than
anything. It could easily be done in java. The routine that follows writes
all the lines to the PAGSEG source. It pulls info from the TIFF page that
has been analyzed in prior module and set up so writeAPagSeg can reference
it directly by tag pointer. I have actually done the TIFF tag analysis
portion in java. fwrite in here is the C standard library function and could
be writing directly to a file output stream or to a user space.
TIFF and IOCA objects both contain a compressed image. Most of the time it's
a JPEG if color or a CCITT Group 4 if bitonal. This handles either.
pwriteAPagSeg b export
d pi
d tagPointerArrayPointer...
d * value
d fileOutStream * value
d tag273 s *
d tag279 s *
d tag296 s *
d tag282 s *
d tag283 s *
d tag256 s *
d tag257 s *
d tag259 s *
d hres s 10u 0
d vres s 10u 0
d i s 10u 0
d ds
d iocaBuffer 4a
d tiffTagPointer s *
D/copy DKDEVLIB/QRPGLESRC,TIFFTAGSTR
c/free
// look for tags that require special processing
for i=1 to tagCount;
tiffTagPointer = tagPointerArray(i);
select;
when tagID=273;
tag273= tagPointerArray(i);
when tagID=279;
tag279= tagPointerArray(i);
when tagID=296;
tag296= tagPointerArray(i);
when tagID=282;
tag282= tagPointerArray(i);
hres = tagValue(1)/tagValue(2);
when tagID=283;
tag283= tagPointerArray(i);
vres = tagValue(1)/tagValue(2);
when tagID=256;
tag256= tagPointerArray(i);
when tagID=257;
tag257= tagPointerArray(i);
when tagID=259;
tag259= tagPointerArray(i);
endsl;
endfor;
// stream over open physical file in QTEMP
fwrite(
x'5A0010D3A85F0000004040404040404040': // Begin Page Segment
1:17:fileOutStream);
fwrite(
x'5A0020D3EEEE000000'+'RJS PAGSEG Builder c2006': // NOP
1:33:fileOutStream);
fwrite(
x'5A0010D3A8FB0000004040404040404040': // Begin Image Object
1:17:fileOutStream);
fwrite(
x'5A0010D3A8C70000004040404040404040': // Begin Object
Environment
1:17:fileOutStream);
fwrite(
x'5A001CD3A66B000000': // Object Area Descriptor
1:9:fileOutStream);
fwrite(
x'034301': // triplet X43 Descriptor Position
1:3:fileOutStream);
fwrite(
x'084B0000': // triplet X4B Measurement Unit
1:4:fileOutStream);
tiffTagPointer=tag282;
fwrite(
makeByteIOCA(iocaBuffer:2:14400):
// makeByteIOCA(iocaBuffer:2:10*tagValue(1)/tagValue(2)): // H
resolution 2 byte
1:2:fileOutStream);
hres = tagValue(1)/tagValue(2);
tiffTagPointer=tag283;
fwrite(
makeByteIOCA(iocaBuffer:2:14400):
// makeByteIOCA(iocaBuffer:2:10*tagValue(1)/tagValue(2)): // V
resolution 2 byte
1:2:fileOutStream);
fwrite(
x'094C02': // triplet X4C Object Area Size
1:3:fileOutStream);
fwrite(
x'00': //
1:1:fileOutStream);
tiffTagPointer=tag256;
fwrite(
makeByteIOCA(iocaBuffer:2:tagValue(1)/hres*1440): // H size 2
byte
1:2:fileOutStream);
fwrite(
x'00': //
1:1:fileOutStream);
tiffTagPointer=tag257;
fwrite(
makeByteIOCA(iocaBuffer:2:tagValue(1)/vres*1440): // V size 2
byte
1:2:fileOutStream);
fwrite(
x'5A0020D3AC6B000000': // Object Area Position
1:9:fileOutStream);
fwrite(
x'011700000000000000002D00': //con't
1:12:fileOutStream);
fwrite(
x'0000000000000000002D0000': // con't
1:12:fileOutStream);
fwrite(
x'5A000DD3ABFB0000000005030410': // Map Image Object
1:14:fileOutStream);
fwrite(
// x'5A001BD3A6FB000000': // Image Data Descriptor
x'5A0015D3A6FB000000': // Image Data Descriptor
1:9:fileOutStream);
tiffTagPointer=tag296;
select;
when tagValue(1)=2;
fwrite(
x'00': // unit base - 10 inches
1:1:fileOutStream);
when tagValue(1)=3;
fwrite(
x'01': // unit base - 10 centimeters
1:1:fileOutStream);
when tagValue(1)=1;
fwrite(
x'02': //unit base - logical ratio
1:1:fileOutStream);
other;
fwrite(
x'03': //unit base - logical ratio
1:1:fileOutStream);
endsl;
tiffTagPointer=tag282;
fwrite(
makeByteIOCA(iocaBuffer:2:10*tagValue(1)/tagValue(2)): // H
resolution 2 byte
1:2:fileOutStream);
tiffTagPointer=tag283;
fwrite(
makeByteIOCA(iocaBuffer:2:10*tagValue(1)/tagValue(2)): // V
resolution 2 byte
1:2:fileOutStream);
tiffTagPointer=tag256;
fwrite(
makeByteIOCA(iocaBuffer:2:tagValue(1)): // H size 2 byte
1:2:fileOutStream);
tiffTagPointer=tag257;
fwrite(
makeByteIOCA(iocaBuffer:2:tagValue(1)): // V size 2 byte
1:2:fileOutStream);
// fwrite(
// x'F60400000000': // image color triplet
// 1:6:fileOutStream);
fwrite(
x'F702010A': // function set ID
1:4:fileOutStream);
fwrite(
x'5A0008D3A9C7000000': // End Object Environment
1:9:fileOutStream);
// now the IOCA stuff in Image Picture Data tags
fwrite(
x'5A000AD3EEFB0000007000': // Begin Segment
1:11:fileOutStream);
fwrite(
x'5A000BD3EEFB0000009101FF': // Image Content':
1:12:fileOutStream);
fwrite(
x'5A0013D3EEFB0000009409': // Image Size -- first two bytes
1:11:fileOutStream);
tiffTagPointer=tag296;
select;
when tagValue(1)=2;
fwrite(
x'00': // 10 inches
1:1:fileOutStream);
when tagValue(1)=3;
fwrite(
x'01': // 10 centimeters
1:1:fileOutStream);
when tagValue(1)=1;
fwrite(
x'02': // logical
1:1:fileOutStream);
other;
fwrite(
x'03': // who knows?
1:1:fileOutStream);
endsl;
tiffTagPointer=tag282;
fwrite(
makeByteIOCA(iocaBuffer:2:10*tagValue(1)/tagValue(2)): // H
resolution 2 byte
1:2:fileOutStream);
tiffTagPointer=tag283;
fwrite(
makeByteIOCA(iocaBuffer:2:10*tagValue(1)/tagValue(2)): // V
resolution 2 byte
1:2:fileOutStream);
tiffTagPointer=tag256;
fwrite(
makeByteIOCA(iocaBuffer:2:tagValue(1)): // H size 2 byte
1:2:fileOutStream);
tiffTagPointer=tag257;
fwrite(
makeByteIOCA(iocaBuffer:2:tagValue(1)): // V size 2 byte
1:2:fileOutStream);
fwrite(
x'5A000CD3EEFB0000009502':
1:11:fileOutStream);
tiffTagPointer=tag259;
select;
when tagValue(1)=1;
fwrite(
x'0301':// Image Encoding - No Compression - RIDIC
1:2:fileOutStream);
when tagValue(1)=2;
fwrite(
x'8001':// Image Encoding - 1D - RIDIC
1:2:fileOutStream);
when tagValue(1)=3;
fwrite(
x'8101':// Image Encoding - G3 MMR - RIDIC
1:2:fileOutStream);
when tagValue(1)=4;
fwrite(
x'8201':// Image Encoding - G4 MMR - RIDIC
1:2:fileOutStream);
when tagValue(1)=5;
fwrite(
x'0D01':// Image Encoding - LZW - RIDIC
1:2:fileOutStream);
when tagValue(1)=6;
fwrite(
x'8301': // Image Encoding - JPEG - RIDIC
1:2:fileOutStream);
other;
fwrite(
x'0301':
1:2:fileOutStream);
endsl;
//fwrite(
// x'5A000BD3EEFB000000960101': // IDE size -- 1 bit per
pixel
// 1:12:fileOutStream);
//fwrite(
// x'5A000BD3EEFB000000970100': // LUT-ID - standard
// 1:12:fileOutStream);
tiffTagPointer = tag279;
for i = 1 to tagValueCount;
doTheChunks(fileOutStream:tag273:i:tagValue(i));
ENDFOR;
fwrite(
x'5A000AD3EEFB0000009300': // End Image Content
1:11:fileOutStream);
fwrite(
x'5A000AD3EEFB0000007100': // End Segment
1:11:fileOutStream);
fwrite(
x'5A0010D3A9FB000000FFFF40404040': // End Image Object
1:17:fileOutStream);
fwrite(
x'5A0010D3A95F000000FFFF40404040': // End Page Segment
1:17:fileOutStream);
/end-free
p e
As an Amazon Associate we earn from qualifying purchases.
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.