2

We have flat file which has html elements data. Program converting this data to .DOC using CPYTOIMPF and mail to the user. Office automatically converting html tags and showing in proper format.

As per new requirement, Flat file data need to be convert into PDF. I tried with spooling(RUNQRY) and used CPYSPLF but it didn't work. I got html tags like text(ex: "Tag>Invoice</Tag") instead of formatted text.

Is there a way to make this work in CLLE/RPGLE?

Sam K
  • 103
  • 4
  • this is very doable using a package called `Mpdf` in `PHP`. Where you build a text stream that combines HTML and the text data. By coding the PHP as a web service it can be run directly from RPG by calling the `HTTPPOSTCLOB` SQL function. – RockBoro Sep 07 '22 at 02:10

1 Answers1

1

If the HTML is predictable and well formatted, you might be able to use the RPG opcode XML-INTO to parse it into a data structure. You can then print a report and spool it out to a PDF. This is just a direction to go, but IBM i can convert a spooled report into a PDF for you.

jmarkmurphy
  • 11,030
  • 31
  • 59
  • Hi SAM, this is the way to copy a spool to PDF format: `CPYSPLF FILE(QPQUPRFIL) TOFILE(*TOSTMF) SPLNBR(*LAST) TOSTMF('/MyFolder/test_1.pdf') WSCST(*PDF) STMFOPT(*REPLACE)` – Nifriz Sep 16 '22 at 08:41