PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Thu Aug 14, 2025 2:25 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Nov 19, 2012 2:44 pm 
Offline

Joined: Sun Nov 18, 2012 8:35 am
Posts: 3
Hi,
When building a Document, I set the Tag and Comment properties of paragraphs like this:

myParagraph01.Tag = "Para01";
myParagraph01.Comment = "Para01";
myParagraph02.Tag = "Para02";
myParagraph02.Comment = "Para02";

Then I send the Document to the viewer like this:

string ddl = DdlWriter.WriteToString(myDocument);
myDocumentPreview.Ddl = ddl;

which works fine.

Now I would like to get the tag values, but I cant seem to get them:

DocumentRenderer renderer = this.myDocumentPreview.Renderer;
DocumentObject[] documentObjects = renderer.GetDocumentObjectsFromPage(1); // Get all page 1 DOM elements
MigraDoc.DocumentObjectModel.Paragraph p = (MigraDoc.DocumentObjectModel.Paragraph)documentObjects[0];

It seems to 'see' the single paragraph I have added to the single Section, but not the Tag or Comment properties as they are empty.

How can I achieve this?
Thanks,
Brad.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 19, 2012 3:46 pm 
Offline
PDFsharp Guru
User avatar

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

Tag is of type object. It could be that tags do not persist the WriteToString call.

Try "myDocumentPreview.Document = myDocument;" instead.

_________________
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 150 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