コード例 #1
0
        protected void GvGeneratePDF(object sender, EventArgs e)
        {
            var transactionDetail =
                PageDataService.GetTransactionDetailByTransactionDetailIdAdoNet(
                    Convert.ToInt32(GvTransactionDetail.SelectedValue.ToString()));
            var pdfHelpers = new PdfHelpers();

            if (Convert.ToBoolean(transactionDetail.Approved))
            {
                var filePathWithName = pdfHelpers.CreatePdf(transactionDetail);

                Response.ContentType = "application/pdf";

                Response.AddHeader("content-disposition", "attachment; filename=" + filePathWithName);

                FileStream sourceFile = new FileStream(Server.MapPath(Constants.AccounStudentFeePdf) + filePathWithName,
                                                       FileMode.Open);

                long FileSize;

                FileSize = sourceFile.Length;

                byte[] getContent = new byte[(int)FileSize];

                sourceFile.Read(getContent, 0, (int)sourceFile.Length);

                sourceFile.Close();

                Response.BinaryWrite(getContent);
            }
        }
コード例 #2
0
        public PdfText(int objectNumber, string text, float x, float y, MediaBox mediaBox) : base(objectNumber)
        {
            MediaBox = mediaBox;
            X        = x;
            Y        = PdfHelpers.ScreenPosition(y, mediaBox.Height);

            AddTextStream("F1", 18, X, Y, this.Text); // Table 5 PDF spec entries common to all stream dictionaries
        }
コード例 #3
0
        public PdfImageTransform(
            int objectNumber,
            string fileName,
            string imageName,
            float x,
            float y,
            float width,
            float height,
            MediaBox mediaBox) : base(objectNumber)
        {
            FileName  = fileName;
            ImageName = imageName;
            Width     = width;
            Height    = height;
            X         = x;
            Y         = PdfHelpers.ScreenPosition(y, mediaBox.Height);

            AddImageStream();
        }