Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

898998: update the github sample. #90

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions Text/Line-limit-in-PDF/.NET/Line_limit_in_PDF/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,33 @@
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;

// Define a multi-line string
string text = @"PdfStringFormat 1
PdfStringFormat 2
PdfStringFormat 3
PdfStringFormat 4
PdfStringFormat 5
";

// Create a new PdfStringFormat and set its properties
PdfStringFormat format = new PdfStringFormat();
format.ClipPath = true;
format.NoClip = false;
//Set no clip
format.NoClip = true;
//Set line limit
format.LineLimit = false;

// Create a new PdfFont using the Helvetica font family and size 12
// Create a new PdfFont using the Helvetica font family
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);

// Create a new PdfDocument
PdfDocument document = new PdfDocument();
// Set the page margins to zero
document.PageSettings.Margins.All = 0;

// Add a new page to the document
PdfPage page = document.Pages.Add();

// Get the graphics object of the page
PdfGraphics graphics = page.Graphics;

// Draw a red rectangle at the specified position and size
graphics.DrawRectangle(PdfPens.Red, new RectangleF(100, 100, 100, 20));

// Draw the string inside the rectangle with the specified font, brush, and format
graphics.DrawString(text, font, PdfBrushes.Black, new RectangleF(100, 100, 100, 20), format);
graphics.DrawString("PDF text line 1 \r\nPDF text line 3", font, PdfBrushes.Black, new RectangleF(100, 100, 100, 20), format);

// Create a memory stream to save the PDF document
MemoryStream stream = new MemoryStream();
// Save the document to the memory stream
Expand Down
Loading