Itext pdf landscape




















For example, the next one : convertToPdf InputStream htmlStream, PdfDocument pdfDocument, ConverterProperties converterProperties Now the only thing you need is to set the page size to the document before converting the html file.

Improve this answer. Uladzimir Asipchuk Uladzimir Asipchuk 1, 1 1 gold badge 7 7 silver badges 15 15 bronze badges.

Thank you, pdfDocument. Sai prateek Sai prateek But how can I pass html file as input? I am converting a html file to pdf.

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. I'm not a developer, i always use this free online pdf to word converter to convert pdf to word online. Do you have any recommendations? Post a Comment. Search Here. Document We have to tell this class the page size of the pdf in the following way. See the solution below: document. A4 is a static variable of type com. Rectangle So by rotating it you are getting the landscape size of A4 page.

GetPageN page ; pageDict. Put PdfName. AddPage copy. GetInstance doc, ms ; doc. Add new Phrase "hello world" ; doc. I used something like this. GetPageSizeWithRotation i ; switch psize. Now, instantiate the Image class of the com. While instantiating, pass the ImageData object , as a parameter to its constructor, as shown below.

To this method, you need to pass an integer representing the rotation angle by which you want to rotate the image. Now, add the image object created in the previous step using the add method of the Document class, as shown below. The following Java program demonstrates how to rotate an image by a given angle on a PDF document using the iText library.

It creates a PDF document with the name rotatingImage.



0コメント

  • 1000 / 1000