PDF .NET Library Logo

How to use PDFTechLib in restricted (hosting) environments.

"Pdfdocument" object constructor accepts a stream object.

You can use "response.OutputStream" to create a PDF in restricted environments.


You must upload the fonts you wish to use into an alternate directory because most hosting environments will not allow access to the Windows/Fonts directory. See this page on how this can be done: Setting an Alternate Fonts Directory

C# sample:

PDFCreationOptions opt = new PDFCreationOptions();

opt.FontDirectory = Request.PhysicalApplicationPath + "\\Fonts";

Response.Charset = "utf-8";

Response.AddHeader("Last-Modified", DateTime.Now.ToString("r"));

Response.CacheControl = "public";

Response.AddHeader("Content-Disposition", "attachment; filename=Barcode.pdf");

Response.ContentType = "application/pdf";

PDFDocument doc = new PDFDocument(Response.OutputStream, opt);

doc.CurrentPage.Body.AddText("sample text");



Back to PDF Code Library