Esempio n. 1
0
        private void DoExport(C1PdfDocumentSource pds, ExportProvider ep)
        {
            saveFileDialog1.DefaultExt = "." + ep.DefaultExtension;
            saveFileDialog1.FileName   = Path.GetFileName(tbFile.Text) + "." + ep.DefaultExtension;
            saveFileDialog1.Filter     = string.Format("{0} (*.{1})|*.{1}|All files (*.*)|*.*", ep.FormatName, ep.DefaultExtension);
            if (saveFileDialog1.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            try
            {
                var exporter = ep.NewExporter();
                exporter.ShowOptions = false;
                exporter.FileName    = saveFileDialog1.FileName;
                if (exporter.ShowOptionsDialog())
                {
                    pds.Export(exporter);
                    MessageBox.Show(this, "Document was successfully exported.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void DoPrint(C1PdfDocumentSource pds)
        {
            printDialog.MaxPage = (uint)pds.PageCount;
            bool?dr = printDialog.ShowDialog();

            if (!dr.HasValue || !dr.Value)
            {
                return;
            }

            try
            {
                var po = new C1PrintOptions();
                po.PrintQueue  = printDialog.PrintQueue;
                po.PrintTicket = printDialog.PrintTicket;
                if (printDialog.PageRangeSelection == PageRangeSelection.UserPages)
                {
                    po.OutputRange = new OutputRange(printDialog.PageRange.PageFrom, printDialog.PageRange.PageTo);
                }
                pds.Print(po);
                MessageBox.Show(this, "Document was successfully printed.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 3
0
        private void DoExport(C1PdfDocumentSource pds, ExportProvider ep)
        {
            saveFileDialog.DefaultExt = "." + ep.DefaultExtension;
            saveFileDialog.FileName   = System.IO.Path.GetFileName(fpFile.SelectedFile.FullName) + "." + ep.DefaultExtension;
            saveFileDialog.Filter     = String.Format("{0} (*.{1})|*.{1}|All files (*.*)|*.*", ep.FormatName, ep.DefaultExtension);
            bool?dr = saveFileDialog.ShowDialog(this);

            if (!dr.HasValue || !dr.Value)
            {
                return;
            }

            try
            {
                var exporter = ep.NewExporter();
                exporter.ShowOptions = false;
                exporter.Preview     = true;
                exporter.FileName    = saveFileDialog.FileName;
                pds.Export(exporter);
                MessageBox.Show(this, "Document was successfully exported.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 protected override void OnClosed(EventArgs e)
 {
     fv.DocumentSource = null;
     pdfDocumentSource.Dispose();
     pdfDocumentSource = null;
     base.OnClosed(e);
 }
        private void BtnOpen6_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter      = "PDF File (Pdf Files|*.pdf|All files (*.*)|*.*";
            ofd.Multiselect = true;
            ofd.Title       = "My Image Browser";
            if (bc.iniC.labOutOpenFileDialog.Length > 0)
            {
                ofd.InitialDirectory = bc.iniC.labOutOpenFileDialog;
            }
            DialogResult dr = ofd.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                String[] file1 = ofd.FileNames;
                filename6    = file1[0];
                lbName6.Text = filename6;
                if (!bc.iniC.windows.ToLower().Equals("windowsxp"))
                {
                    C1PdfDocumentSource pds = new C1PdfDocumentSource();
                    pds.LoadFromFile(filename6);
                    fvLabOut6.DocumentSource = pds;
                }
                tC.SelectedTab = tabLabOut6;
            }
        }
Esempio n. 6
0
        async Task LoadPdf(string pdfName)
        {
            if (_pdfDocSource == null)
            {
                _pdfDocSource = new C1PdfDocumentSource();
            }
            // load pdf
            try
            {
                // load from resource stream
                _pdfDocSource.UseSystemRendering = false;
                var memStream = new MemoryStream();
                using (Stream stream = _asm.GetManifestResourceStream("FlexReportSamples.Resources." + pdfName))
                {
                    await stream.CopyToAsync(memStream);

                    memStream.Position = 0;
                }
                await _pdfDocSource.LoadFromStreamAsync(memStream.AsRandomAccessStream());
            }
            catch (Exception ex)
            {
                MessageDialog md = new MessageDialog(string.Format(Strings.FailedToLoadFmt, pdfName, ex.Message), "Error");
                await md.ShowAsync();

                return;
            }
            flexViewer.DocumentSource = _pdfDocSource;
        }
Esempio n. 7
0
        private void LoadSourcePlainText(bool startUp)
        {
            if (textBox3.Text.Substring(textBox3.Text.Length - 4) == ".pdf")
            {
                using (var pdfSource = new C1PdfDocumentSource())
                {
                    pdfSource.LoadFromFile(textBox3.Text);

                    using (var ctx = new C1DXTextMeasurementContext())
                    {
                        textBox4.Text = pdfSource.GetWholeDocumentRange(ctx).GetText();
                    }
                }
                if (!startUp)
                {
                    MessageBox.Show("Plain text from specified .pdf file loaded sucessfully!", "C1TextParser Winforms Edition", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                if (textBox3.Text.Substring(textBox3.Text.Length - 5) == ".docx")
                {
                    using (var plainTextStream = new MemoryStream())
                    {
                        using (C1.C1Word.C1WordDocument doc = new C1.C1Word.C1WordDocument())
                        {
                            doc.Load(textBox3.Text);
                            doc.Save(plainTextStream, C1.C1Word.FileFormat.Text);
                            var plainTextStream1 = new MemoryStream((plainTextStream as MemoryStream).ToArray());
                            plainTextStream1.Position = 0;
                            var reader = new StreamReader(plainTextStream1);
                            textBox4.Text = reader.ReadToEnd();

                            reader.Dispose();
                            plainTextStream.Dispose();
                            plainTextStream1.Dispose();
                        }
                    }
                    if (!startUp)
                    {
                        MessageBox.Show("Plain text from specified .docx file loaded sucessfully!", "C1TextParser Winforms Edition", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    var fileStream = File.OpenRead(textBox3.Text);
                    var reader     = new StreamReader(fileStream);
                    textBox4.Text = reader.ReadToEnd();

                    fileStream.Dispose();
                    reader.Dispose();

                    if (!startUp)
                    {
                        MessageBox.Show("Text from specified file loaded sucessfully!", "C1TextParser Winforms Edition", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
Esempio n. 8
0
        private void FrmShowPdf_Load(object sender, EventArgs e)
        {
            if (stream == null)
            {
                return;
            }
            C1PdfDocumentSource pds = new C1PdfDocumentSource();

            pds.LoadFromStream(stream);
            c1FlexViewer1.DocumentSource = pds;
        }
Esempio n. 9
0
        void ViewerPage_Unloaded(object sender, RoutedEventArgs e)
        {
            cbReport.SelectionChanged -= CbReport_SelectionChanged;

            flexViewer.DocumentSource = null;
            if (_pdfDocSource != null)
            {
                _pdfDocSource.Dispose();
                _pdfDocSource = null;
            }
            _report.Dispose();
            _report = null;
        }
Esempio n. 10
0
        private void DoPrint(C1PdfDocumentSource pds)
        {
            if (printDialog1.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            try
            {
                C1PrintOptions po = new C1PrintOptions();
                po.PrinterSettings = printDialog1.PrinterSettings;
                pds.Print(po);
                MessageBox.Show(this, "Document was successfully printed.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public static void Save(this C1PdfDocument pdf)
        {
            var pdfDocSource = new C1PdfDocumentSource();
            var flexViewer   = new C1FlexViewer();

            flexViewer.DocumentSource = pdfDocSource;
            pdfDocSource.LoadFromStream(PdfUtils.SaveToStream(pdf));

            //var dlg = new SaveFileDialog();
            //dlg.DefaultExt = ".pdf";
            //var dr = dlg.ShowDialog();
            //if (!dr.HasValue || !dr.Value)
            //{
            //    return;
            //}

            //using (var stream = dlg.OpenFile())
            //{
            //    pdf.Save(stream);
            //}
        }
Esempio n. 12
0
        private void BtnPrint_Click(object sender, EventArgs e)
        {
            int  gapLine = 40, gapX = 40, gapY = 20, xCol2 = 130, xCol1 = 20, xCol3 = 300, xCol4 = 390, xCol5 = 1030;
            Size size = new Size();

            String statusOPD = "", vsDate = "", vn = "", an = "", anDate = "", doccd = "", docno = "", anyr = "", vn1 = "", pathFolder = "", datetick = "", filename = "", docyr = "", amt2 = "";
            String doc = "", datestart = "";
            //DataTable dt = new DataTable();
            DataTable dt = new DataTable();

            dt = bc.bcDB.pttscDB.SelectByDoc(txtPaidType.Text.Trim());

            DateTime dtstart = new DateTime();

            DateTime.TryParse(txtDateStart.Text, out dtstart);
            if (bc.iniC.windows.Equals("windosxp"))
            {
                if (dtstart.Year > 2500)
                {
                    dtstart = dtstart.AddYears(-543);
                }
                else if (dtstart.Year < 2000)
                {
                    dtstart = dtstart.AddYears(543);
                }
            }
            datestart = dtstart.ToString("dd-MM-yyyy", new CultureInfo("en-US"));

            //throw new NotImplementedException();
            C1PdfDocument       pdf = new C1PdfDocument();
            C1PdfDocumentSource pds = new C1PdfDocumentSource();
            StringFormat        _sfRight, _sfRightCenter;

            //Font _fontTitle = new Font("Tahoma", 15, FontStyle.Bold);
            _sfRight                     = new StringFormat();
            _sfRight.Alignment           = StringAlignment.Far;
            _sfRightCenter               = new StringFormat();
            _sfRightCenter.Alignment     = StringAlignment.Far;
            _sfRightCenter.LineAlignment = StringAlignment.Center;

            //RectangleF rc = GetPageRect(pdf);
            Font titleFont = new Font(bc.iniC.pdfFontName, 18, FontStyle.Bold);
            Font hdrFont   = new Font(bc.iniC.pdfFontName, 14, FontStyle.Regular);
            Font hdrFontB  = new Font(bc.iniC.pdfFontName, 16, FontStyle.Bold);
            Font ftrFont   = new Font(bc.iniC.pdfFontName, 8);
            Font txtFont   = new Font(bc.iniC.pdfFontName, 10, FontStyle.Regular);

            //pdf.Clear();
            pdf.FontType = FontTypeEnum.Embedded;

            //newPagePDFSummaryBorder(pdf, dt, titleFont, hdrFont, ftrFont, txtFont, false);

            //get page rectangle, discount margins
            RectangleF rcPage = pdf.PageRectangle;

            rcPage = RectangleF.Empty;
            rcPage.Inflate(-72, -92);
            rcPage.Location = new PointF(rcPage.X, rcPage.Y + titleFont.SizeInPoints + 10);
            rcPage.Size     = new SizeF(0, titleFont.SizeInPoints + 3);
            rcPage.Width    = 610;
            rcPage.Height   = gapLine;

            gapY += gapLine;
            gapY += gapLine;

            String space2 = "    ", space3 = "      ", space4 = "        ", space5 = "          ", space = "";
            int    rowline = 0, i = 0;

            rowline = 205;

            String txt = "ใบนำส่งรายชื่อ ผู้มาตรวจ COVID " + (bc.iniC.branchId.Equals("001") ? "บางนา 1" : bc.iniC.branchId.Equals("002") ? "บางนา 2" : "ไม่ระบุ");

            pdf.DrawString(txt, titleFont, Brushes.Black, rcPage);

            gapY           += gapLine;
            rcPage.Location = new PointF(rcPage.X, rcPage.Y + titleFont.SizeInPoints + 10);
            rcPage.Size     = new SizeF(0, titleFont.SizeInPoints + 3);
            rcPage.Width    = 610;
            txt             = " ประจำวันที่ " + datestart + " จำนวนผู้มาตรวจ " + dt.Rows.Count;
            pdf.DrawString(txt, titleFont, Brushes.Black, rcPage);

            gapY           += gapLine;
            rcPage.Location = new PointF(rcPage.X, rcPage.Y + titleFont.SizeInPoints + 10);
            rcPage.Size     = new SizeF(0, titleFont.SizeInPoints + 3);
            rcPage.Width    = 610;
            txt             = " เลขที่ " + txtPaidType.Text.Trim();
            pdf.DrawString(txt, titleFont, Brushes.Black, rcPage);

            datetick = DateTime.Now.Ticks.ToString();
            if (!Directory.Exists("report"))
            {
                Directory.CreateDirectory("report");
            }
            filename = "report\\" + datetick + ".pdf";
            pdf.Save(filename);
            pdf.Clear();
            pdf.Dispose();

            if (File.Exists(filename))
            {
                //bool isExists = System.IO.File.Exists(filename);
                //if (isExists)
                System.Diagnostics.Process.Start(filename);
            }
        }
        private void BtnHn_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            FrmSearchHn frm = new FrmSearchHn(bc, FrmSearchHn.StatusConnection.host);

            frm.ShowDialog(this);
            String[] an = bc.sPtt.an.Split('/');
            //if (an.Length > 1)
            //{
            //    txtAN.Value = an[0];
            //    txtAnCnt.Value = an[1];
            //}
            //else
            //{
            txtAN.Value    = bc.sPtt.an;
            txtAnCnt.Value = "";
            //}
            txtHn.Value        = bc.sPtt.Hn;
            txtName.Value      = bc.sPtt.Name;
            txtVN.Value        = bc.sPtt.vn;
            txtVisitDate.Value = bc.sPtt.visitDate;
            txtPreNo.Value     = bc.sPtt.preno;

            txtAnDate.Value = bc.sPtt.anDate;
            chkIPD.Checked  = bc.sPtt.statusIPD.Equals("I") ? true : false;

            if (chkIPD.Checked)
            {
                txtVisitDate.Hide();
                txtAnDate.Show();
                label6.Text = "AN Date :";
            }
            else
            {
                txtVisitDate.Show();
                txtAnDate.Hide();
                label6.Text = "Visit Date :";
            }
            DataTable dt = new DataTable();

            dt = bc.bcDB.labexDB.selectByVn(txtHn.Text.Trim(), txtVN.Text.Trim().Replace("/", ".").Replace("(", ".").Replace(")", ""));
            if (dt.Rows.Count > 0)
            {
                le.Id       = dt.Rows[0][bc.bcDB.labexDB.labex.Id].ToString();
                le.Hn       = dt.Rows[0][bc.bcDB.labexDB.labex.Hn].ToString();
                le.Vn       = dt.Rows[0][bc.bcDB.labexDB.labex.Vn].ToString();
                le.YearId   = dt.Rows[0][bc.bcDB.labexDB.labex.YearId].ToString();
                txtId.Value = le.Id;
            }
            else
            {
                le.Id     = "";
                le.Hn     = txtHn.Text.Trim();
                le.Vn     = txtVN.Text.Trim();
                le.YearId = DateTime.Now.Year.ToString();
            }
            if (!bc.iniC.windows.ToLower().Equals("windowsxp"))
            {
                C1PdfDocumentSource pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("1"));
                fvLabOut1.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("2"));
                fvLabOut2.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("3"));
                fvLabOut3.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("4"));
                fvLabOut4.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("5"));
                fvLabOut5.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("6"));
                fvLabOut6.DocumentSource = pds;
            }
            else
            {
                lbName1.Text = "...";
                lbName2.Text = "...";
                lbName3.Text = "...";
                lbName4.Text = "...";
                lbName5.Text = "...";
                lbName6.Text = "...";
                loadPDF("1");
                loadPDF("2");
                loadPDF("3");
                loadPDF("4");
                loadPDF("5");
                loadPDF("6");
            }
        }
        private void printReserveVaccinePDF()
        {
            String pathFolder = "", filename = "", datetick = "";
            int    gapLine = 20, gapLine1 = 15, gapX = 40, gapY = 20, xCol2 = 200, xCol1 = 160, xCol3 = 300, xCol4 = 390, xCol5 = 500;
            Size   size = new Size();

            C1PdfDocument       pdf = new C1PdfDocument();
            C1PdfDocumentSource pds = new C1PdfDocumentSource();
            StringFormat        _sfRight, _sfRightCenter;

            //Font _fontTitle = new Font("Tahoma", 15, FontStyle.Bold);
            _sfRight                     = new StringFormat();
            _sfRight.Alignment           = StringAlignment.Far;
            _sfRightCenter               = new StringFormat();
            _sfRightCenter.Alignment     = StringAlignment.Far;
            _sfRightCenter.LineAlignment = StringAlignment.Center;

            Font titleFont = new Font(bc.iniC.pdfFontName, bc.pdfFontSizetitleFont, FontStyle.Bold);
            Font hdrFont   = new Font(bc.iniC.pdfFontName, bc.pdfFontSizehdrFont, FontStyle.Regular);
            Font hdrFontB  = new Font(bc.iniC.pdfFontName, 16, FontStyle.Bold);
            Font ftrFont   = new Font(bc.iniC.pdfFontName, 8);
            Font txtFont   = new Font(bc.iniC.pdfFontName, bc.pdfFontSizetxtFont, FontStyle.Regular);

            pdf.FontType = FontTypeEnum.Embedded;

            RectangleF rcPage = pdf.PageRectangle;

            rcPage = RectangleF.Empty;
            rcPage.Inflate(-72, -92);
            rcPage.Location = new PointF(rcPage.X, rcPage.Y + titleFont.SizeInPoints + 10);
            rcPage.Size     = new SizeF(0, titleFont.SizeInPoints + 3);
            rcPage.Width    = 110;

            Image loadedImage;

            loadedImage = Resources.LOGO_BW_tran;
            float newWidth  = loadedImage.Width * 100 / loadedImage.HorizontalResolution;
            float newHeight = loadedImage.Height * 100 / loadedImage.VerticalResolution;

            float widthFactor  = 4.8F;
            float heightFactor = 4.8F;

            if (widthFactor > 1 | heightFactor > 1)
            {
                if (widthFactor > heightFactor)
                {
                    widthFactor = 1;
                    newWidth    = newWidth / widthFactor;
                    newHeight   = newHeight / widthFactor;
                    //newWidth = newWidth / 1.2;
                    //newHeight = newHeight / 1.2;
                }
                else
                {
                    newWidth  = newWidth / heightFactor;
                    newHeight = newHeight / heightFactor;
                }
            }

            RectangleF recf = new RectangleF(15, 15, (int)newWidth, (int)newHeight);

            pdf.DrawImage(loadedImage, recf);
            rcPage.X = gapX + recf.Width - 10;
            rcPage.Y = gapY;
            RectangleF rc = rcPage;

            string[] filePaths = Directory.GetFiles(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\slip\\", txtID.Text.Trim() + "*.jpg");
            if (filePaths.Length > 0)
            {
                int i = 1, xx = 40;
                foreach (String filename1 in filePaths)
                {
                    Image loadedImage1, resizedImage1 = null;
                    loadedImage1 = Image.FromFile(filename1);
                    int originalWidth = 0;
                    originalWidth = loadedImage1.Width;
                    int newWidth1 = 200;

                    resizedImage1 = loadedImage1.GetThumbnailImage(newWidth1, (newWidth1 * loadedImage1.Height) / originalWidth, null, IntPtr.Zero);
                    RectangleF recf1 = new RectangleF(i == 1?xx: newWidth1 + 10, 380, (int)newWidth1, (int)resizedImage1.Height);
                    pdf.DrawImage(loadedImage1, recf1);
                    i++;
                }
            }
            Image      qrcode = c1BarCode1.Image;
            RectangleF recf2  = new RectangleF(350, 500, qrcode.Width, qrcode.Height);

            pdf.DrawImage(qrcode, recf2);

            size         = bc.MeasureString(bc.iniC.hostname, titleFont);
            rcPage.Width = size.Width;
            pdf.DrawString(bc.iniC.hostname, titleFont, Brushes.Black, rcPage);
            gapY        += gapLine;
            rcPage.Y     = gapY;
            size         = bc.MeasureString(bc.iniC.hostaddresst, hdrFont);
            rcPage.Width = size.Width;
            pdf.DrawString(bc.iniC.hostaddresst, hdrFont, Brushes.Black, rcPage);

            String dose = "", amt11 = "";
            int    amt111 = 0;

            dose = txtDose.Text.Replace("จอง", "").Replace("เข็ม", "").Replace("3,300", "").Replace("1,650", "").Replace("4,950", "").Trim().Replace("6,600", "").Trim().Replace("8,250", "")
                   .Replace("8,250", "").Replace("9,900", "").Replace("11,500", "").Replace("13,200", "").Replace("14,850", "").Replace("16,500", "").Replace("18,150", "").Replace("19,800", "").Trim();
            int.TryParse(dose, out amt111);
            amt111 *= 1650;

            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapX  = xCol1;
            rc.X  = (pdf.PageSize.Width / 2) - 15;
            rc.Y  = gapY;
            pdf.DrawString("ใบจองวัคซีน", titleFont, Brushes.Black, rc);

            gapY += gapLine;
            gapY += gapLine;
            gapX  = 30;
            rc.X  = gapX;
            rc.Y  = gapY;
            pdf.DrawString("ข้าพเจ้า ชื่อ-นามสกุล", txtFont, Brushes.Black, rc);
            rc.X = 110;
            rc.Y = rc.Y - 4;
            pdf.DrawString(txtName.Text, hdrFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 100, gapY + 15, 380, gapY + 15);
            rc.X = 400;
            rc.Y = gapY;
            pdf.DrawString("เลขที่ประชาชน", txtFont, Brushes.Black, rc);
            rc.X = 470;
            rc.Y = rc.Y - 4;
            pdf.DrawString(txtPID.Text, hdrFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 455, gapY + 15, 590, gapY + 15);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = gapX;
            rc.Y  = gapY;
            pdf.DrawString("ที่อยู่ปัจจุบัน", txtFont, Brushes.Black, rc);
            rc.X = 75;
            rc.Y = rc.Y - 4;
            pdf.DrawString(txtAddress.Text, hdrFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 70, gapY + 15, 400, gapY + 15);
            rc.X = 420;
            rc.Y = gapY;
            pdf.DrawString("เบอร์ที่ติดต่อได้", txtFont, Brushes.Black, rc);
            rc.X = 480;
            rc.Y = rc.Y - 4;
            pdf.DrawString(txtMobile.Text, hdrFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 470, gapY + 15, 590, gapY + 15);

            gapY    += gapLine;
            gapX     = 30;
            rc.X     = gapX;
            rc.Y     = gapY;
            rc.Width = 610;
            pdf.DrawString("ขอจองวัคซีนทางเลือก MODERNA และชำระเงิน  จำนวน             โดส   ราคา 1,650 บาทต่อโดส", txtFont, Brushes.Black, rc);
            rc.X = 19;
            rc.Y = rc.Y - 4;
            pdf.DrawString(dose, hdrFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 215, gapY + 15, 220, gapY + 15);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = gapX;
            rc.Y  = gapY;
            pdf.DrawString("ราคาดังกล่าวเป็นราคาที่ รวมค่าวัคซีน  ค่าประกัน  ค่าบริการสำหรับการฉีด ไม่รวมค่าแพทย์ ถ้าต้องการพบแพทย์  โดยชำระเงินเต็มจำนวน", txtFont, Brushes.Black, rc);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = gapX;
            rc.Y  = gapY;
            pdf.DrawString("โดสละ 1,650  รวม            โดส  เป็นเงิน                               บาท  ตามใบเจองเลขที่                            ", txtFont, Brushes.Black, rc);
            rc.X = 100;
            rc.Y = rc.Y - 4;
            pdf.DrawString(dose, hdrFont, Brushes.Black, rc);
            rc.X = 175;
            rc.Y = rc.Y;
            pdf.DrawString(amt111.ToString("#,###.00"), hdrFont, Brushes.Black, rc);
            rc.X = 310;
            rc.Y = rc.Y;
            pdf.DrawString(txtID.Text.Trim(), hdrFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 95, gapY + 15, 100, gapY + 15);
            pdf.DrawLine(Pens.Gray, 165, gapY + 15, 220, gapY + 15);
            pdf.DrawLine(Pens.Gray, 340, gapY + 15, 470, gapY + 15);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = gapX;
            rc.Y  = gapY;
            pdf.DrawString("หมายเหตุ  1.ทางโรงพยาบาลจะนัดรับวัคซีนหลังจาก โรงพยาบาลได้รับการจัดสรรจากหน่วยงานภาครัฐ  ตามที่อยู่และเบอร์โทรที่ได้ให้ไว้", txtFont, Brushes.Black, rc);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = 67;
            rc.Y  = gapY;
            pdf.DrawString("2.กรณีได้รับจัดสรรวัคซีนมาไม่เพียงพอต่อการจองที่โรงพยาบาลได้รับจองตามที่ได้รับจัดสรร  ทางโรงพยาบาลจะเรียงลำดับการเข้ารับวัคซีนตามลำดดับการจองก่อน-หลัง", txtFont, Brushes.Black, rc);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = 67;
            rc.Y  = gapY;
            pdf.DrawString("และจะคืนเงินมัดจำให้เต็มจำนวน  กรณีจองแล้วไม่ได้", txtFont, Brushes.Black, rc);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = 67;
            rc.Y  = gapY;
            pdf.DrawString("3.ทางโรงพยาบาลสงวนสิทธิ์ยกเลิกการของโดยไม่คืนเงินกรณีผู้จองไม่มารับวัคซีนตามช่วงเวลาที่กำหนด", txtFont, Brushes.Black, rc);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = 67;
            rc.Y  = gapY;
            pdf.DrawString("4.ห้ามนำวัคซีนไปขายต่อเพราะเป็นสินค้าควบคุมราคา", txtFont, Brushes.Black, rc);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = 67;
            rc.Y  = gapY;
            pdf.DrawString("5.ต้องมารับบริการฉีดวัคซีน ที่โรงพยาบาล บางนา5 เท่านั้น", txtFont, Brushes.Black, rc);

            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapX  = 30;
            rc.X  = 370;
            rc.Y  = gapY;
            pdf.DrawString("ผู้จอง", txtFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 400, gapY + 15, 500, gapY + 15);

            gapY += gapLine;
            gapX  = 30;
            rc.X  = 370;
            rc.Y  = gapY;
            pdf.DrawString("ผู้รับจอง  on line", txtFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 400, gapY + 15, 500, gapY + 15);

            String txt = "";

            if (txtDate.Text.Trim().Length > 9)
            {
                txt = bc.datetoShow(txtDate.Text.Trim()) + " " + txtDate.Text.Substring(10).Trim();
            }
            else
            {
                txt = txtDate.Text.Trim();
            }
            gapY += gapLine;
            gapX  = 30;
            rc.X  = 370;
            rc.Y  = gapY;
            pdf.DrawString("วันที่จอง   " + txt, txtFont, Brushes.Black, rc);
            pdf.DrawLine(Pens.Gray, 400, gapY + 15, 500, gapY + 15);

            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapY += gapLine;
            gapX  = 30;
            rc.X  = gapX;
            rc.Y  = gapY;
            pdf.DrawString("สอบถามเพิ่มเติมโทร 02 138 1155-60 ต่อ 143   ", txtFont, Brushes.Black, rc);
            gapY += gapLine;
            gapX  = 30;
            rc.X  = gapX;
            rc.Y  = gapY;
            pdf.DrawString("วันจันทร์ ถึง วันศุกร์ เวลา 8.00 - 16.00 น. (ปิดพักเที่ยง)   ", txtFont, Brushes.Black, rc);
            gapY += gapLine;
            gapX  = 30;
            rc.X  = gapX;
            rc.Y  = gapY;
            pdf.DrawString("line @657bkkyq", txtFont, Brushes.Black, rc);


            RectangleF rcHdr = new RectangleF();

            rcHdr.Width  = pdf.PageSize.Width - 20;
            rcHdr.Height = pdf.PageSize.Height - 20;
            rcHdr.X      = 10;
            rcHdr.Y      = 10;
            String PathName = "medical", fileName = "";

            datetick = DateTime.Now.Ticks.ToString();
            if (!Directory.Exists("report"))
            {
                Directory.CreateDirectory("report");
            }
            fileName = "report\\" + txtID.Text.Trim() + "_" + datetick + ".pdf";
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
                System.Threading.Thread.Sleep(100);
            }
            pdf.DrawRectangle(Pens.Black, rcHdr);       // ตาราง

            String path = Path.GetDirectoryName(Application.ExecutablePath);

            pdf.Save(path + "\\" + fileName);
            Process.Start(fileName);
        }