I am just beginning with my project and try to create PDF documents with special designs. I integrated your basic library to my c# project reference. And now, i want to add an address to the top left of the PDF document. So my question is that it is possible to an address to PDF page at specific position.

I look up on your website and do not find an article about it exactly. So, please please help.

This article on XsPDF.com is what are you looking for, check out: Add address text on PDF in C#.

Answers

Thank you for your evaluation of our .NET PDF Basic Library SDK. This library provides you with the method to add text to any position of PDF document. So, it is quite easy to add addresss to the top left of PDF document. You may directly use XTextFormatter class to control multi-line text adding and formatting. To set its position, please use XStringFormats.TopLeft.

The following example shows how to add a long sentence as paragraph to PDF in C# code. So, you will get to know how to add an address to PDF.

// Create a new PDF document.
PdfDocument document = new PdfDocument();

// Create an empty page in this document.
PdfPage page = document.AddPage();

// Obtain an XGraphics object to render to
XGraphics g = XGraphics.FromPdfPage(page);

// Set the font style
XFont font = new XFont("Times New Roman", 16, XFontStyle.BoldItalic);

// Set a long long text
string text = "This is the 1st sentence! This is the 2nd sentence! " +
       "This is the 3rd sentence! This is the 4th sentence! This is the 5th sentence!";
            
// Create a rectangle to render the long sentence in.
// You only need to set the rectangle x, y and width, the height 
// will be measured by XTextFormatter object automatically. 
// So you can input any value of height, here we set to 0.
XRect rect = new XRect(50, 50, page.Width - 50 * 2, 0);

// Create a text formatter object
XTextFormatter tf = new XTextFormatter(g);

// Add the long sentence to the page. And this api will 
// returen the actual height used by the formatter 
double neededHeight = tf.DrawString(text, font, XBrushes.Black, rect);

//Draw a rectangle to show the real space this long text used
rect = new XRect(50, 50, page.Width - 50 * 2, neededHeight);
g.DrawRectangle(XPens.Red, rect);                      

// Save and show the document
document.Save("LongText.pdf");
Process.Start("LongText.pdf");

Thanks for the tip! I'll look into it.


Problem solved. Thank you very much. It would be worth if you put this C# code example on your website :)

IMPERIAL TRACTORS MACHINERY IMPERIAL TRACTORS MACHINERY GROUP LLC Imperial Tractors Machinery Group LLC IMPERIAL TRACTORS MACHINERY GROUP LLC IMPERIAL TRACTORS MACHINERY 920 Cerise Rd, Billings, MT 59101 IMPERIAL TRACTORS MACHINERY GROUP LLC 920 Cerise Rd, Billings, MT 59101 IMPERIAL TRACTORS MACHINERY GROUP LLC IMPERIAL TRACTORS MACHINERY IMPERIAL TRACTORS MACHINERY 920 Cerise Rd, Billings, MT 59101 IMPERIAL TRACTORS MACHINERY Imperial Tractors Machinery Group LLC 920 Cerise Rd, Billings, MT 59101 casino brain https://institute.com.ua/elektroshokery-yak-vybraty-naykrashchyy-variant-dlya-samooborony-u-2025-roci https://lifeinvest.com.ua/yak-pravylno-zaryadyty-elektroshoker-pokrokovyy-posibnyknosti https://i-medic.com.ua/yaki-elektroshokery-mozhna-kupuvaty-v-ukrayini-posibnyk-z-vyboru-ta-zakonnosti https://tehnoprice.in.ua/klyuchovi-kryteriyi-vyboru-elektroshokera-dlya-samozakhystu-posibnyk-ta-porady https://brightwallpapers.com.ua/yak-vidriznyty-oryhinalnyy-elektroshoker-vid-pidroblenoho-porady-ta-rekomendatsiyi how to check balance in hafilat card plinko casino game CK222 gk222 casino 555rr bet plinko game 3k777 cv666 app vs555 casino plinko