Question

If you do a google search you will find some code samples more or less like this:

PdfWriter writer = PdfWriter.GetInstance(document, myIoStream);

And interestingly, most of the code samples don't use the writer object at all. So, what's the point of getting that handle? Thank you!

Was it helpful?

Solution

You can do just PdfWriter.getInstance(document, myIoStream);

this will "create" the document using the stream.

When using PdfWriter writer = PdfWriter.GetInstance(document, myIoStream);

we can use a lot of methods like AddAnnotation() that will be merged with the document or also call .DirectContent to add images, etc.

Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top