PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Feb 12, 2025 1:06 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Why is my text wrapping?
PostPosted: Sun Dec 08, 2024 10:02 pm 
Offline

Joined: Sat Oct 05, 2024 2:34 pm
Posts: 2
When I am putting in text it is wrapping at about 1/3 of the page.
MY Code

PdfDocument pdfdoc = new PdfDocument();
PdfPage pdfpage = pdfdoc.AddPage();
pdfpage.Orientation = PageOrientation.Landscape;

Document document = new Document();

DocumentRenderer xrend = new DocumentRenderer(document);
xrend.PrepareDocument();

Section sect1 = document.AddSection();
Paragraph para = document.LastSection.AddParagraph();
para.Format.Font.Name = "Arial";
para.Format.Font.Size = 28;
para.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkBlue;
para.Format.Font.Bold = true;

para.Format.KeepTogether = true; // just added to see if it would work

para.AddText(sTitle);
para.AddLineBreak();

subTitle = " now is the time for all good men to come to the aid of their country regardless of wheter " +
"they have too or not it just does not matter";


if (subTitle != null)

para.AddText(subTitle);


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 09, 2024 8:52 pm 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1030
Location: CCAA
Call "PrepareDocument()" once after adding all contents to the document. Anything else does not make sense.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group