[go: up one dir, main page]

0% found this document useful (0 votes)
18 views1 page

Offer Letter Code Using Csharp

Uploaded by

p.lavanyajanu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Offer Letter Code Using Csharp

Uploaded by

p.lavanyajanu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

using Syncfusion.

Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Grid;
using System.IO;
using Microsoft.AspNetCore.Mvc;

namespace YourNamespace.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class OfferLetterController : ControllerBase
{
[HttpGet]
[Route("GenerateOfferLetter")]
public IActionResult GenerateOfferLetter()
{
// Create a new PDF document.
PdfDocument document = new PdfDocument();
// Add a page to the document.
PdfPage page = document.Pages.Add();
// Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
// Set the standard font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);

// Add the header


graphics.DrawString("Offer Letter", font, PdfBrushes.Black, new
PointF(0, 0));

// Add the body content


string bodyText = "Dear [CandidateName],\n\nWe are pleased to offer you
the position of [JobTitle] " +
"at [CompanyName]. Your skills and experiences make
you an excellent fit for our team.\n\n" +
"Your start date will be [StartDate], with a starting
salary of [Salary] " +
"and [Benefits] benefits.\n\n" +
"We look forward to your acceptance of this offer.
Please sign and return this letter by [AcceptanceDate].\n\n" +
"Sincerely,\n\n[YourName]\n[YourTitle]";

graphics.DrawString(bodyText, font, PdfBrushes.Black, new RectangleF(0,


20, page.GetClientSize().Width, page.GetClientSize().Height));

// Save the document to a memory stream.


MemoryStream stream = new MemoryStream();
document.Save(stream);
stream.Position = 0;

// Close the document.


document.Close(true);

// Define the content type and return the PDF document.


return File(stream, "application/pdf", "OfferLetter.pdf");
}
}
}

You might also like