GetRight() public method

Returns the upper right x-coordinate, considering a given margin.
public GetRight ( float margin ) : float
margin float a margin
return float
        private void CreateReport(string filePath)
        {
            AppFileTemplate f = (AppFileTemplate)DataContext;

            // margins
            float left   = 30;
            float right  = 10;
            float top    = 10;
            float bottom = 10;
            float headH  = 20;
            float indent = 5;

            //string fontName = "C:\\WINDOWS\\FONTS\\CALIBRI.TTF";
            string fontName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "CALIBRI.TTF");

            iText.Font     NormalSatirFont  = iText.FontFactory.GetFont(fontName, "CP1254", 10, iText.Font.NORMAL);
            iText.Font     BoldSatirFont    = iText.FontFactory.GetFont(fontName, "CP1254", 10, iText.Font.BOLD);
            iText.Font     NormalRiseFont   = iText.FontFactory.GetFont(fontName, "CP1254", 8, iText.Font.NORMAL);
            iText.Font     NormalSymbolFont = iText.FontFactory.GetFont(iText.FontFactory.SYMBOL, 10, iText.Font.NORMAL);
            iText.Document doc = new iText.Document(iText.PageSize.A4, left, right, top, bottom);

            float xLL = doc.GetLeft(left);
            float yLL = doc.GetBottom(bottom);
            float xUR = doc.GetRight(right);
            float yUR = doc.GetTop(top);
            float w   = xUR - xLL;
            float h   = yUR - yLL;
            float xUL = xLL;
            float yUL = yUR;
            float xLR = xUR;
            float yLR = yLL;
            //float graphW = w - 10;
            //float graphH = graphW * 2 / 3;


            float graphH = 3 * h / 5;
            float graphW = w - 10;


            PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(filePath, FileMode.Create));

            doc.Open();

            // direct content
            PdfContentByte cb = writer.DirectContent;

            // çizgiler
            DrawLine(cb, xUR - w, yUR, xUR, yUR);
            DrawLine(cb, xUR - w, yUR, xLL, yLL);
            DrawLine(cb, xLL, yLL, xLL + w, yLL);
            DrawLine(cb, xLL + w, yLL, xUR, yUR);
            DrawLine(cb, xUL, yUL - headH, xUR, yUR - headH);
            DrawLine(cb, xUL, yUL - headH - graphH, xUR, yUR - headH - graphH);

            // başlık
            ColumnText ct = new ColumnText(cb);

            ct.Indent = indent;
            iText.Phrase txt = new iText.Phrase();
            txt.Add(new iText.Chunk(f.ReportTitle, NormalSatirFont));
            ct.SetSimpleColumn(txt, xUL, yUL - headH, xUR, yUR, headH / 1.5f, iText.Element.ALIGN_LEFT | iText.Element.ALIGN_MIDDLE);
            ct.Go();

            var stream      = new MemoryStream();
            var pngExporter = new PngExporter {
                Width = (int)graphW, Height = (int)graphH, Background = OxyColors.White
            };

            pngExporter.Export(PlotView.Model, stream);

            iText.Image png = iText.Image.GetInstance(stream.GetBuffer());
            png.Alignment = iText.Element.ALIGN_CENTER | iText.Element.ALIGN_MIDDLE;
            png.SetAbsolutePosition(xUL, yUL - headH - graphH);
            doc.Add(png);

            float      kstW    = w / 2;
            float      kstH    = (h - headH - graphH) / 1.5f;
            ColumnText ctKesit = new ColumnText(cb);

            ctKesit.Indent = indent;
            txt            = new iText.Phrase();
            txt.Add(new iText.Chunk("Kesit\n", BoldSatirFont));
            txt.Add(new iText.Chunk(String.Format("Genişlik, b = {0:0} cm\n", f.b), NormalSatirFont));
            txt.Add(new iText.Chunk(String.Format("Yükseklik, h = {0:0} cm\n", f.h), NormalSatirFont));
            txt.Add(new iText.Chunk(String.Format("Alan, bxh = {0:0} cm²\n", f.b * f.h), NormalSatirFont));
            txt.Add(new iText.Chunk("\nMalzeme\n", BoldSatirFont));
            txt.Add(new iText.Chunk("f", NormalSatirFont));
            txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa   ", f.Beton().fc.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
            txt.Add(new iText.Chunk("f", NormalSatirFont));
            txt.Add(new iText.Chunk("y", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().fy.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));

            txt.Add(new iText.Chunk("f", NormalSatirFont));
            txt.Add(new iText.Chunk("cd", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa   ", f.Beton().fcd.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));

            txt.Add(new iText.Chunk("f", NormalSatirFont));
            txt.Add(new iText.Chunk("yd", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().fyd.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));

            txt.Add(new iText.Chunk("E", NormalSatirFont));
            txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa   ", f.Beton().E.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
            txt.Add(new iText.Chunk("E", NormalSatirFont));
            txt.Add(new iText.Chunk("s", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().E.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
            txt.Add(new iText.Chunk("e", NormalSymbolFont));
            txt.Add(new iText.Chunk("cu", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0.0000} m/m   ", f.Beton().Ecu), NormalSatirFont));
            txt.Add(new iText.Chunk("e", NormalSymbolFont));
            txt.Add(new iText.Chunk("yd", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0.00000} m/m\n", f.DonatiCeligi().Eyd), NormalSatirFont));
            txt.Add(new iText.Chunk("k", NormalSatirFont));
            txt.Add(new iText.Chunk("1", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(String.Format(" = {0:0.000}\n", f.Beton().k1), NormalSatirFont));

            ctKesit.SetSimpleColumn(txt, xUL, yUL - headH - graphH - kstH, xUL + kstW, yUL - headH - graphH, 15, iText.Element.ALIGN_LEFT);
            ctKesit.Go();

            ColumnText ctDonati = new ColumnText(cb);

            txt = new iText.Phrase();
            txt.Add(new iText.Chunk("Donatı\n", BoldSatirFont));
            int j = 1;

            foreach (var rb in f.ReinforcingBars)
            {
                txt.Add(new iText.Chunk("A", NormalSatirFont));
                txt.Add(new iText.Chunk(string.Format("s{0}", j), NormalRiseFont).SetTextRise(-1.0f));
                txt.Add(new iText.Chunk(string.Format("={0:0.00} cm², ", rb.As), NormalSatirFont));
                txt.Add(new iText.Chunk("d", NormalSatirFont));
                txt.Add(new iText.Chunk(string.Format("{0}", j), NormalRiseFont).SetTextRise(-1.0f));
                txt.Add(new iText.Chunk(string.Format("={0:0.00} cm\n", rb.di), NormalSatirFont));
                j++;
            }
            txt.Add(new iText.Chunk("r", NormalSymbolFont));
            txt.Add(new iText.Chunk(string.Format("=%{0:0.00}\n", 100.0 * f.ReinforcingBars.Sum(i => i.As) / (f.b * f.h)), NormalSatirFont));
            txt.Add(new iText.Chunk("(d", NormalSatirFont));
            txt.Add(new iText.Chunk("i", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(":Kesit basınç yüzeyinin donatı eksenine uzaklığı)\n", NormalSatirFont));
            txt.Add(new iText.Chunk("\nDayanım Azaltma Katsayıları\n", BoldSatirFont));
            txt.Add(new iText.Chunk("f", NormalSymbolFont));
            txt.Add(new iText.Chunk("a", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00}, ", f.PhiA), NormalSatirFont));
            txt.Add(new iText.Chunk("f", NormalSymbolFont));
            txt.Add(new iText.Chunk("b", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00}, ", f.PhiB), NormalSatirFont));
            txt.Add(new iText.Chunk("f", NormalSymbolFont));
            txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00}", f.PhiC), NormalSatirFont));
            //txt.Add(new iText.Chunk("\n\nTasarım:\n", BoldSatirFont));
            //txt.Add(new iText.Chunk(f.Code.ToString(), NormalSatirFont));
            ctDonati.SetSimpleColumn(txt, xUL + kstW, yUL - headH - graphH - kstH, xUL + 2 * kstW, yUL - headH - graphH, 15, iText.Element.ALIGN_LEFT);
            ctDonati.Go();

            ColumnText ctTesir = new ColumnText(cb);

            ctTesir.Indent = indent;
            txt            = new iText.Phrase();
            txt.Add(new iText.Chunk("Maksimum eksenel basınç, N", NormalSatirFont));
            txt.Add(new iText.Chunk("max", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t\n", f.Pmax), NormalSatirFont));
            txt.Add(new iText.Chunk("Maksimum eksenel çekme, N", NormalSatirFont));
            txt.Add(new iText.Chunk("min", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t\n\n", f.Pmin), NormalSatirFont));

            txt.Add(new iText.Chunk("Yönetmelik maksimum eksenel basınç sınırı, N", NormalSatirFont));
            txt.Add(new iText.Chunk("max", NormalRiseFont).SetTextRise(-1.0f));
            txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t", f.ActualPmax), NormalSatirFont));
            ctTesir.SetSimpleColumn(txt, xUL, yUL - headH - graphH - 1.5f * kstH, xUL + kstW, yUL - headH - graphH - kstH, 15, iText.Element.ALIGN_LEFT);
            ctTesir.Go();

            doc.Close();
        }