LONG MemoryFileSize { get; } |
ou can use the MemoryFileSize property to get the size of a file generated in memory. The property works only if the GenerateInMemoryFile property is VARIANT_TRUE. To use this property in the full version of the library, you must have an additional Web license.
Equivalent in new interface: IPDFDocument4::GetBufferSize.
{ PDF object is supposed to be created } PDF.StartEngine('demo', 'demo'); PDF.GenerateInMemoryFile := true; PDF.BeginDoc; { some operations here... } PDF.EndDoc; Response.Clear; Response.ContentType := 'application/pdf'; Response.AddHeader('Content-Type', 'application/pdf'); Response.AddHeader('Content-Disposition', 'inline;filename=form.pdf'); Response.AddHeader('Content-Length', PDF.MemoryFileSize); Response.BinaryWrite(PDF.BinaryImage); Response.End;
// PDF object is supposed to be created PDF->StartEngine("demo", "demo"); PDF->GenerateInMemoryFile = TRUE; PDF->BeginDoc(); // some operations here... PDF->EndDoc(); Response->Clear(); Response->ContentType = "application/pdf"; Response->AddHeader("Content-Type", "application/pdf"); Response->AddHeader("Content-Disposition", "inline;filename=form.pdf"); Response->AddHeader("Content-Length", itoa(PDF.MemoryFileSize)); Response->BinaryWrite(PDF->BinaryImage); Response->End();
// PDF object is supposed to be created PDF.StartEngine("demo", "demo"); PDF.GenerateInMemoryFile = true; PDF.BeginDoc(); // some operations here... PDF.EndDoc(); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "inline;filename=form.pdf"); Response.AddHeader("Content-Length", PDF.MemoryFileSize.ToString()); Response.BinaryWrite(PDF.BinaryImage); Response.End();
' PDF object is supposed to be created PDF.StartEngine("demo", "demo") PDF.GenerateInMemoryFile = True PDF.BeginDoc ' some operations here... PDF.EndDoc Response.Clear Response.ContentType = "application/pdf"' Response.AddHeader "Content-Type", "application/pdf" Response.AddHeader "Content-Disposition", "inline;filename=form.pdf" Response.AddHeader "Content-Length", PDF.MemoryFileSize Response.BinaryWrite PDF.BinaryImage Response.End