Reputation: 627
Everywhere I get examples of creating PdfDocument
like this:
PdfDocument document = PdfReader.Open(fiePath, PdfDocumentOpenMode.Import);
But I don't have the path of file. I want to convert Stream
to PdfDocument
. I tried this:
PdfDocument document = new PdfDocument(stream);
but it always gives 0
as PageCount
and PageSize
.
Upvotes: 1
Views: 4047
Reputation: 21689
PdfReader.Open
can be invoked with a filename or with a stream.
What you tried (new PdfDocument(stream)
) creates a new and empty document that can be written to the stream by invoking Save()
without parameter. This creates a document, but does not open it.
Upvotes: 4