PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 9:01 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Jun 30, 2014 3:17 pm 
Offline

Joined: Mon Jun 30, 2014 3:00 pm
Posts: 1
Hi,

I am working on a project that generates a PDF dynamically from a template. The template format we have allows text alignment to be in one of 9 positions within a bounding rectangle (Top Left, Center Center, Bottom Right etc). It also expects text to wrap if it exceeds the width of the bounding rectangle.

Using XGraphics.DrawString and passing in an XStringFormat, I can set the text alignment to be one of the 9 values by setting different combinations of XStringAlignment and XLineAlignment. However, when calling XGraphics.DrawString, word wrapping does not seem to be supported.

I have read (http://pdfsharp.net/wiki/TextLayout-sample.ashx) that to allow word wrapping I should use XTextFormatter.DrawString. However, this thows an exception when using an XStringFormat with XStringAlignment and XLineAlignment anything other than Near. I can set the horizontal positioning of the text using XTestFormatter.Alignment, but I can't seem to find a way to set a vertical position.

I'm aware that the documentation recommends using Migradoc for this sort of thing, but I need to absolutely position the bounding rectangle (the software that generates the templates I am rendering allows things to be placed anywhere on the page), and from my experience of using Migradoc items are only placed by inserting them after the last inserted item. Please correct me if I am wrong.

Please let me know if I am missing something, or alternately suggest a workaround if possible. We're using Pdfsharp/Migradoc for various other things and would like to keep using the library for this new requirement if possible.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 144 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