Пример #1
0
        private static TextArea textAreaAyarla(string[] textArray, PdfOzellikleri pdfOzellikleri)
        {
            TextArea  textArea = pdfOzellikleri.TextAreaDon();
            TextStyle style    = PdfOzellikleri.Style;

            foreach (string satir in textArray)
            {
                string yazilacakText;

                if (satir == string.Empty)
                {
                    yazilacakText = " ";
                }
                else
                {
                    if (satir.StartsWith(" "))
                    {
                        yazilacakText = BoslukYerineUygunKarakter + satir.Substring(1);
                    }
                    else
                    {
                        yazilacakText = satir;
                    }
                }

                textArea.NewLine();
                textArea.AddContent(yazilacakText, style);
            }

            return(textArea);
        }
Пример #2
0
        static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                return(ReturnTypes.EksikParametre);
            }

            string path = args[0];

            string[] textArray = textArrayAl(path);

            PdfOzellikleri pdfOzellikleri = new PdfOzellikleri(textArray.Take(100));

            Document doc = new Document();

            doc.Compress = false;
            TextArea textArea = textAreaAyarla(textArray, pdfOzellikleri);

            while (textArea != null)
            {
                Page page = pdfOzellikleri.YeniPageAl();

                doc.Pages.Add(page);
                PDFGraphics graphics = page.Graphics;

                //DrawText richtext at x = 50; y =75 and height = 650
                //OverflowText is return as RichText
                //Loop until there is no overflow.
                textArea = graphics.DrawTextArea(0, 0, textArea);
            }

            FileStream fs = kaydedilecekDosyaDon(path);

            try
            {
                doc.Generate(fs);
                return(ReturnTypes.Basarili);
            }
            catch (Exception)
            {
                return(ReturnTypes.BilinmeyenHata);
            }
            finally
            {
                fs.Flush();
                fs.Close();
            }
        }