0

I want to update the writer in PDFStamper in itext. I am using getWriter method to get the writer of my stamper object. Updated the run direction for that writer but I'm not able to understand how can I set this writer to stamper. Adding the code I tried here:

PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
stamper.getWriter().setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
System.out.println(stamper.getWriter().getRunDirection());
stamper.close();
reader.close();

This is not working and somehow run direction stays the same. Can you please help me resolve this issue?

andrewJames
  • 19,570
  • 8
  • 19
  • 51
  • You cannot _set_ the writer of a `PdfStamper`. Also, have you read the JavaDocs of the methods involved? The `setRunDirection` JavaDocs say "This is only used as a placeholder as it does not affect anything." – mkl Sep 26 '22 at 21:29
  • Is there anyway to set run direction in stamper? – Amit Padia Sep 27 '22 at 05:32
  • Run direction can be set while writing content. Here you are not writing anything, only simply reading it – shihabudheenk Sep 27 '22 at 06:11
  • If I remember correctly, the run direction in iText before version 7.x only could be non-LTR inside tables (see `PdfPTable`) or when using `ColumnText` directly. (I never needed to create non-LTR content, so please take this with a grain of salt.) – mkl Sep 27 '22 at 07:39

0 Answers0