Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

This question is the follow up to another question on stackoverflow.

I open an existing PDF with this code snippet:

reader = New PdfReader(filenameSource)
writer = New PdfWriter(destFile)
pdf = New PdfDocument(reader, writer)
doc = New Document(pdf, pdf.GetDefaultPageSize, False)

I can add a paragraph now via doc.add(new Paragraph(...)) But when I try to place a table with table.setFixedPosition(...), the table doesn´t show on the page.

Has anybody any hint for me?

Thanks and best regards

Benjamin

PdfReader reader = new PdfReader("LoremIpsum.pdf");
PdfWriter writer = new PdfWriter("LoremIpsum-with-positioned-table.pdf");
PdfDocument pdf = new PdfDocument(reader, writer);
Document doc = new Document(pdf, pdf.GetDefaultPageSize(), false);
Table table = new Table(new float[] { 200 });
table.AddCell(new Cell().Add(new Paragraph("test")).SetBackgroundColor(ColorConstants.CYAN));
table.SetFixedPosition(1, 100, 100, 200);
doc.Add(table);
doc.Close();

This didn't reproduce your issue

when I try to place a table with table.setFixedPosition(...), the table doesn´t show on the page.

because the result looks like this:

The table clearly shows.

Thank you very much for your effort. I appreciate this very much! I will go back into my own code and look for the error - that must be in there anywhere. I will come back here to tell my results or any new questions.... – BeSt Nov 26, 2018 at 8:11 I don´t know what my error was - but I deleted the whole code and wrote it again, and I was very accurate.... and now it works. Sorry for bothering you and thank you for your help! – BeSt Dec 3, 2018 at 16:00

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.