How can I set two tables parallelly in a document
My sample code for generate pdf is,
Document doc = new Document(new Rectangle(288f, 144f), 10
There are a number of issues in your code. The ones immediately visible:
You don't close the document doc
but only at closing time certain important parts of the PDF are created, in particular the cross reference table. Thus, you have to close the document as soon as possible after completing its content.
You try to write the doc
to the response:
Response.Write(doc);
This is wrong, you have to direct the output of your PdfWriter
to the response. You actually do this, too, kind of trying to transmit the PDF twice:
PdfWriter writer = PdfWriter.GetInstance(doc, Response.OutputStream);
But:
You change response properties after starting to write a response, i.e. you first create a PDF streaming it to Response.OutputStream
and only thereafter change the content type, content disposition, and cache headers.
This quite likely either makes the Response
ignore your settings or forget what has been streamed into it up to then.
Until you have fixed these issues, I would propose you create a simple HelloWorld PDF instead of your parallel tables to not have problems in PDF generation and problems in the use of web service classes like Response
intermingle with each other.