Components for Developers
© 2000-2008, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
Common
Collapse All

Returns a generated PDF document as a byte array.

Syntax

VARIANT GetBuffer ()
Return value
Array of bytes representing the PDF document.

Remarks

Method returns a generated PDF file as a byte array and can be used within functions for streaming output to PDF. To use this method in the full version of the library, you must have at least Web License.

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 }
font := PDF.AddFont('Arial', false, false, false, false, fcDefault);
PDF.UseFont(font, 10);
PDF.ShowTextAt(10, 10, 'This is the 1st page.');

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.GetBufferSize.ToString());
Response.BinaryWrite(PDF.GetBuffer()); 
Response.End();
C/C++
[copy to clipboard]
// PDF object is supposed to be created
long font = PDF->AddFont("Arial", false, false, false, false, fcDefault);
PDF->UseFont(font, 10)
PDF->ShowTextAt(10, 10, "This is the 1st page.");

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->GetBufferSize()));
Response->BinaryWrite((byte*)PDF->GetBuffer()); 
Response->End();
C#
[copy to clipboard]
// PDF object is supposed to be created
long font = PDF.AddFont("Arial", false, false, false, false, FontCharset.fcDefault);
PDF.UseFont(font, 10);
PDF.ShowTextAt(10, 10, "This is the 1st page.");

Response.Clear(); 
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "inline;filename=form.pdf");
Response.AddHeader("Content-Length", PDF.GetBufferSize.ToString());
Response.BinaryWrite((byte[])PDF.GetBuffer()); 
Response.End();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
font = PDF.AddFont("Arial", false, false, false, false, 1) 'fcDefault
PDF.UseFont font, 10
PDF.ShowTextAt 10, 10, "This is the 1st page."

Response.Clear
Response.ContentType = "application/pdf"
Response.AddHeader "Content-Type", "application/pdf"
Response.AddHeader "Content-Disposition", "inline;filename=test.pdf"
Response.AddHeader "Content-Length", PDF.GetBufferSize
Response.BinaryWrite PDF.GetBuffer

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2008, Two Pilots