iTextSharp + FileStream = Corrupt PDF file

前端 未结 5 1714
有刺的猬
有刺的猬 2020-12-05 16:04

I am trying to create a pdf file with iTextSharp. My attempt writes the content of the pdf to a MemoryStream so I can write the result both into file and a database BLOB. Th

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 16:57

    Just some thoughts - what happens if you replace the memory stream with a file stream? Does this give you the result you need? This will at least tell you where the problem could be.

    If this does work, how do the files differ (in size and binary representation)?

    Just a guess, but have you tried seeking to the beginning of the memory stream before writing?

    myMemoryStream.Seek(0, SeekOrigin.Begin);
    

提交回复
热议问题