// You may also change texts, positions and more by editing directly the method generatePrinterFriendlyVersion below // ################################################################################################################## protected void Page_Load(object sender, EventArgs e) { // Get document ID from query string var fileId = Request.QueryString["file"]; // Locate document and read content from storage var fileContent = StorageMock.Read(fileId); // Check if doc already has a verification code registered on storage var verificationCode = StorageMock.GetVerificationCode(fileId); if (verificationCode == null) { // If not, generate a code and register it verificationCode = Util.GenerateVerificationCode(); StorageMock.SetVerificationCode(fileId, verificationCode); } // Generate the printer-friendly version var pfvContent = generatePrinterFriendlyVersion(fileContent, verificationCode); // Return printer-friendly version as a downloadable file Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=printer-friendly.pdf"); Response.BinaryWrite(pfvContent); Response.End(); }