BinaryImage
IPDFDocument3 :: General document methods

See Also Example
Collapse All

This property returns a generated PDF document as a byte array.

Syntax

VARIANT BinaryImage { get; }
Value
Array of bytes representing the PDF document.

Remarks

BinaryImage returns a generated PDF file as a byte array and can be used within functions for streaming output to a PDF. The property is available only with PDF documents created in memory when GenerateInMemoryFile 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::GetBuffer.

Example

How to Create a PDF Document and Return the Data in the Web Application with the Response Abstract Class

Delphi
[copy to clipboard]
{ 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;
C/C++
[copy to clipboard]
// 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((byte*)PDF->BinaryImage); 
Response->End();
C#
[copy to clipboard]
// 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((byte[])PDF.BinaryImage); 
Response.End();
Visual Basic
[copy to clipboard]
' 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

See Also

Reference