Skip to Content

How to generate a PDF in SAP Cloud Integration / HCI

Hi,

I am looking for the best way to generate a pdf in SAP Cloud Integration based upon incoming data.
I assume this needs to be done with scripting but I am not sure how or which libraries to use for this (Ghost4J maybe).

What would be the procedure ?

Thanks

Tom

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 15, 2017 at 08:00 AM

    Hi tom,

    You can you itext package also to generate pdf through groovy, Please see below link that might help you.

    https://milkedeek.wordpress.com/2012/01/03/itext-on-the-jvm/

    Regards

    GB

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Gagandeep,

      I am working with the web ui and apparently need a way to add external packages.
      Am I correct in assuming the external jars must be in package src.main.resources.lib?

      I am not sure if this is already possible via the web ui, maybe via download integration and edit. Otherwise revert to Eclipse for these cases.

      Regards

      Tom

  • Sep 15, 2017 at 09:48 AM

    Hi Gagandeep,

    Thanks for your answer.

    I saw that itext package as well. the problem I have with this (and other packages) that they do not seem to import in groovy. I get error messages like this:

    javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script261.groovy: 9: unable to resolve class com.itextpdf.text.pdf.PdfWriter @ line 9, column 1. import com.itextpdf.text.pdf.PdfWriter ^

    Script261.groovy: 6: unable to resolve class com.itextpdf.text.Document @ line 6, column 1. import com.itextpdf.text.Document ^

    Script261.groovy: 7: unable to resolve class com.itextpdf.text.DocumentException @ line 7, column 1. import com.itextpdf.text.DocumentException ^

    Script261.groovy: 8: unable to resolve class com.itextpdf.text.Paragraph @ line 8, column 1. import com.itextpdf.text.Paragraph ^

    Am I missing something basic here?

    Thanks

    Tom

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 18, 2017 at 06:31 AM

    Hello Tom,

    If you are using eclipse perspective for integration design create package src.main.resources.lib and import your external jar file.Then you can use the respective methods of that particular jar in your script.

    Regards,

    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Sriprasad,

      What would be the syntax for that?

      If I use something like

      message.setHeader("hdrname", "text.pdf");

      the header will only contain the string "text.pdf". If I remove the quotes around the filename the script crashes.

      So how do I set a header parameter to an object within groovy?

      Thanks a lot

      Tom

      message.Seth