Q: We use PDFNET SDK 5 for .NET and use the Export function of the
PDFDraw object to write TIFF files.
Question: How can we write directly into a MemoryStream, instead of a
file?
Our code looks like this:
// PDFDraw class is used to rasterize PDF pages.
PDFDraw draw = new PDFDraw();
// DPI
draw.SetDPI(_objConfig.TIFFResolution);
// Details-/Qualitätseinstellungen
ObjSet objHints = new ObjSet();
Obj objParams = objHints.CreateDict();
if (_objConfig.TIFFG4)
{
// CCIT G4
objParams.PutNumber("BPC", 1);
}
draw.Export(objPage, TempFile, "TIFF", objParams);
objHints.Dispose();
draw..Dispose();
The Export() should write into the memory stream, instead of a file.
--------------------
A: There is no method that serializes a bitmap directly to a memory
stream. You could use draw.GetBitmap() then serialize the
'System.Drawing.Bitmap' to a required image format using MS.NET API
(or some other library). Alternatively you could write to a temp file
then load data into a MemoryStream.