PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 8:19 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
PostPosted: Mon Nov 11, 2013 3:40 pm 
Offline

Joined: Mon Nov 04, 2013 12:58 pm
Posts: 8
hi,

i'm trying to achieve something like this using migradoc and then saving to a pdf:

Image

so far i've tried doing it with text, changing the font size of the quotes and the text:

Code:
var quote = sec.AddParagraph();
quote.Format.Alignment = ParagraphAlignment.Left;

var openQuote = quote.AddFormattedText("\"");
openQuote.Font.Name = "Georgia";
openQuote.Font.Size = 50;
openQuote.Font.Color = MigraDoc.DocumentObjectModel.Colors.Blue;

var quoteText = quote.AddFormattedText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel felis et orci molestie tincidunt a vel nisl. Etiam sagittis fermentum nunc a imperdiet. Nunc interdum orci nec ipsum faucibus, non hendrerit purus adipiscing.");
that it has to offer. There is absolutely no surprise that this is the case.");
quoteText.Font.Name = "Georgia";
quoteText.Font.Size = 10;
quoteText.Font.Color = MigraDoc.DocumentObjectModel.Colors.Green;

var closeQuote = quote.AddFormattedText("\"");
closeQuote.Font.Name = "Georgia";
closeQuote.Font.Size = 50;
closeQuote.Font.Color = MigraDoc.DocumentObjectModel.Colors.Blue;


which gave me:

Image

the issue with this one is the leading on the quotes - i can't find how to do the leading?!?!

so i had a think, and tried to the the quotes as images:

Code:
var quote = sec.AddParagraph();
quote.Format.Alignment = ParagraphAlignment.Left;

quote.AddImage(String.Format("{0}media/quote_left.png", PdfTemplatePath));

var quoteText = quote.AddFormattedText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vel felis et orci molestie tincidunt a vel nisl. Etiam sagittis fermentum nunc a imperdiet. Nunc interdum orci nec ipsum faucibus, non hendrerit purus adipiscing.");
quoteText.Font.Name = "Georgia";
quoteText.Font.Size = 10;
quoteText.Font.Color = MigraDoc.DocumentObjectModel.Colors.Green;

quote.AddImage(String.Format("{0}media/quote_right.png", PdfTemplatePath));


which gave me:

Image

which is closer - but i don't seem to be able to control the alignment of the closing qote image?!?!

am i heading in the right direction with either of these solutions (and missing the final piece of the puzzle...) or is this kinda thing a bit beyond the scope of migradoc?!

cheers,

jake


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 11, 2013 4:09 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi!

With MigraDoc, all items on a line share the same baseline.
IMHO it's correct to use bitmaps.

The bitmaps will be bottom-aligned with the baseline of the characters. Your closing quotes probably have a few empty lines at the bottom.
Playing with "WrapStyle.Through" might lead to the desired result.

See also:
viewtopic.php?p=7198#p7198

_________________
Regards
Thomas Hoevel
PDFsharp Team


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 366 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