Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • mil
      #26226

      Hello,

      I’m currently evaluating pd4ml. I’ve a problem using the method PD4ML.setDynamicParams(). As this works well for parameters defined in the page body, dynamic parameters in the header don’t get replaced by the value stored in the map given to the setDynamicParams() method.

      Here is a code fragment showing how I proceeded:

      [language=java:5w376w5i]final PD4ML pdfCreator = new PD4ML();
      final Map dynamic = new HashMap();
      dynamic.put(“variable”,”value”);
      pdfCreator.setDynamicParams(dynamic);

      final PD4PageMark header = new PD4PageMark();

      //$[variable] is contained in “someHTML”, e.g. $[variable]
      header.setHtmlTemplate(someHTML);

      header.setAreaHeight(-1);
      pdfCreator.setPageHeader(header);

      //if $[variable] is contained in the HTML code returned by url, its value gets replaced as expected
      pdfCreator.render(url, outputStream);[/language:5w376w5i]
      I use the current version of pd4ml (3.5.1b1). Am I doing anything wrong?

      Regards,
      Matthias

      #27385

      Yes, you are right. PD4ML does not substitute placeholders for headers/footers defined that way (however it works for inline headers and footers, i.e. )

      It is quite a trivial task to replace the placeholders in someHTML before it passed to PD4ML. For example, with String.replaceAll() Java API call.

      If the workaround, for some reasons, is not acceptable by you, or if you want to keep the placeholder replacement mechanism of PDF generating module in your application consistent, we could add the feature to the forthcomming release.

      mil
        #27386

        Thanks a lot for your quick response! This restriction won’t be a showstopper for us as there’s the comfortable workaround you’ve mentioned. (We’ve already thought of that workaorund before posting the question to the forum: Our intention was prevent “to reinvent the wheel”, that means use the given method if possible.)

        Regards,
        Matthias

      Viewing 3 posts - 1 through 3 (of 3 total)

      The forum ‘Troubleshooting’ is closed to new topics and replies.