Fri Nov 08, 2019 7:34 am
Hi,
I have PDF file.
My code
static void Main(string[] args)
{
string pdffile = @"C:\fileky.pdf";
Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
doc.LoadFromFile(pdffile);
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Times new roman", 13f, FontStyle.Regular), true);
PdfBrush brush = PdfBrushes.Blue;
float postx = 27.98004f;
float posty = 596.5847f;
float widthvalue = 474.804535f;
string Contents = "Sáng 8/11, Bộ trưởng Thông tin & Truyền thông Nguyễn Mạnh Hùng lần đầu đăng đàn trả lời chất vấn Quốc hội. Ông cũng là thành viên \n- Chính phủ thứ tư trả lời chất vấn tại kỳ họp Quốc hội lần này. Chiều nay, cùng ông Nguyễn Mạnh Hùng, \n-Bộ trưởng Công an Tô Lâm, Bộ trưởng Văn phòng Chính phủ Mai Tiến Dũng và Phó thủ tướng Vũ Đức Đam sẽ tham gia trả lời, làm rõ các vấn đề liên quan.\nTuy nhiên, người đứng đầu ngành cũng khẳng định không đặt mục tiêu thay thế mạng xã hội nước ngoài. \"Việt Nam đã hội nhập, mở cửa kêu gọi đầu tư. Nhưng ai vào Việt Nam làm ăn đều phải tuân thủ pháp luật Việt Nam, giúp Việt Nam thịnh vượng lên";
RectangleF rectf = new RectangleF(postx, posty, widthvalue, 0);
PdfStringFormat format = new PdfStringFormat();
doc.Pages[0].Canvas.DrawString(Contents, font, brush, rectf, format);
string result = @"C:\filekyOK.pdf";
doc.SaveToFile(result);
doc.Close();
}
I am looking for a PdfStringFormat method but I do not understand the uses,
Please help me how to make my text automatically down the line of meaning,
You can view the Text when users type from the web interface and the resulting file,
Note that the width of the text is decided by the user
Login to view the files attached to this post.