"how to convert c# string to pdf" Code Answer's
You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "how to convert c# string to pdf" answered properly. Developers are finding an appropriate answer about how to convert c# string to pdf related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like how to convert c# string to pdf. Enter your desired code related query in the search bar and get every piece of information about C# code related question on how to convert c# string to pdf.
how to convert c# string to pdf
//Create a new PDF documentPdfDocument document = new PdfDocument();//Add a page to the documentPdfPage page = document.Pages.Add();//Create PDF graphics for the pagePdfGraphics graphics = page.Graphics;//set the standard fontPdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);//Read the text from the text fileStreamReader reader = new StreamReader("input.txt", Encoding.ASCII);string text = reader.ReadToEnd();reader.Close();//Set the formats for the textPdfStringFormat format = new PdfStringFormat();format.Alignment = PdfTextAlignment.Justify;format.LineAlignment = PdfVerticalAlignment.Top;format.ParagraphIndent = 15f;//Draw the textgraphics.DrawString(text, font, PdfBrushes.Black, new RectangleF(new PointF(0,0), page.GetClientSize()), format);//Save the documentdocument.Save("OutputText.pdf");//Close the documentdocument.Close(true);//This will open the PDF file so, the result will be seen in default PDF viewerProcess.Start("OutputText.pdf");Copy
Source: www.syncfusion.com
All those coders who are working on the C# based application and are stuck on how to convert c# string to pdf can get a collection of related answers to their query. Programmers need to enter their query on how to convert c# string to pdf related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about how to convert c# string to pdf for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of how to convert c# string to pdf while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "how to convert c# string to pdf". Visit this developer's friendly online web community, CodeProZone, and get your queries like how to convert c# string to pdf resolved professionally and stay updated to the latest C# updates.