0
public static void generate(HttpMethod httpMethod, String formName,
                           String requestSource,
                           MultiValueMap<String, String> parameters) {

        UriComponentsBuilder uriComponentsBuilder = 
        UriComponentsBuilder.fromHttpUrl(htmlFormProperties.getBaseUrl());
        uriComponentsBuilder.queryParam("formName", formName);
        uriComponentsBuilder.queryParam("requestSource", requestSource);
        String htmlForm = htmlFormClientRestTemplate.postForObject(uriComponentsBuilder.build().toUriString(), parameters, String.class);
        ByteArrayOutputStream byteArrayOutputStream = new 
        ByteArrayOutputStream(html.getBytes(Charset.defaultCharset()).length);
        HtmlConverter.convertToPdf(html, byteArrayOutputStream);
    }

We have something like this to convert a html to pdf using HtmlConverter, and I'm trying to change the page orientation to landscape but no luck, is there a way to have dynamic page orientation (Portrait and Landscape) any thoughts/inputs ??

Ramana
  • 1,692
  • 3
  • 18
  • 34
  • Does this answer your question? [How to set orientation to Landscape in iText 7](https://stackoverflow.com/questions/54347293/how-to-set-orientation-to-landscape-in-itext-7) – dekkard Jul 18 '22 at 07:49
  • Thanks for the quick response but I tried that before posting a new question, but that solution did not work for me. – Ramana Jul 18 '22 at 13:12
  • What about this one: https://stackoverflow.com/questions/69141952/convert-html-to-pdf-in-landscape-mode-using-itext ? – dekkard Jul 18 '22 at 13:49
  • I did tried updating CSS to have @page {size: landscape;} but with this change the content in the page showing as landscape and the actual page is still in Portrait, I want to change the page orientation to Landscape. – Ramana Jul 18 '22 at 13:55

0 Answers0