I am preparing a program in RPGLE that will use Java function returning fancy PDF file. I want to take that PDF in RPGLE and create a PDF file on IFS.
For now the Java program returns the PDF in byte[] format. Than I take the byte [] as char in RPG and I try to create stream file out of it. But the PDF is damaged and I can't open it via Adobe Reader...
Below is the prototype of Java procedure and code creating stream file:
D GetPDF PR A ExtProc(*Java:'PDF':'get') Len(16773100) CCSID(*HEX)
Dcl-S wkPDFTxt Char(16773100) CCSID(*HEX);
wkPDFTxt = GetPDF();
fd = open(filePath
:O_CREAT + O_EXCL + O_WRONLY + O_CCSID + O_INHERITMODE
:S_IRUSR
:65535);
write(fd: %addr(wkPDFTxt): %Len(%Trim(wkPDFTxt));
close(fd)
Anyone is familiar with PDF creation and could help me how can I achieve this? I thought that taking byte [] as char() and writing it to stream file in UTF8 would work but it doesn't.