PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon May 28, 2018 3:26 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: RTF/PDF/DDL to XPS?
PostPosted: Wed Jun 21, 2017 8:16 am 
Offline

Joined: Tue Apr 26, 2016 8:24 pm
Posts: 20
Hello everyone,

It is possible to transform RTF/PDF/DDL to XPS with migradoc? (or any free tool out there?)

Or migradoc Document to FixedDocument?

I want to change to a fixed document or xps to be able to use all document viewer functions, such as search and go to bookmark.


Top
 Profile  
Reply with quote  
 Post subject: Re: RTF/PDF/DDL to XPS?
PostPosted: Wed Jun 21, 2017 9:47 am 
Offline
empira Employee
User avatar

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

MigraDoc does not have an XPS renderer yet. Neither is there a FixedDocument renderer.

There are no MigraDoc importers for RTF or PDF yet.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: RTF/PDF/DDL to XPS?
PostPosted: Mon Jun 26, 2017 5:24 pm 
Offline

Joined: Tue Apr 26, 2016 8:24 pm
Posts: 20
Thank you Thomas, I actually managed to convert the document to FixedDocument, that allows me to search into the document. I will post it maybe it will be useful for someone

Preview.Ddl = Convert.ToString(e.NewValue);

var fixedDocument = (FixedDocument)Preview.Viewer.Document;

// Set up fresh XpsDocument
var stream = new MemoryStream();
var uri = new Uri("pack://document.xps", UriKind.Absolute);
var package = Package.Open(stream, FileMode.Create, FileAccess.ReadWrite);
PackageStore.AddPackage(uri, package);
var xpsDoc = new XpsDocument(package, CompressionOption.SuperFast, uri.AbsoluteUri);

// Write FixedDocument to the XpsDocument
var docWriter = XpsDocument.CreateXpsDocumentWriter(xpsDoc);
docWriter.Write(fixedDocument);

FixedDocumentSequence document = xpsDoc.GetFixedDocumentSequence();

// Display XpsDocument in DocumentViewer
Preview.Viewer.Document =document;

Thomas Hoevel wrote:
Hi!

MigraDoc does not have an XPS renderer yet. Neither is there a FixedDocument renderer.

There are no MigraDoc importers for RTF or PDF yet.


Top
 Profile  
Reply with quote  
 Post subject: Re: RTF/PDF/DDL to XPS?
PostPosted: Thu Apr 26, 2018 9:53 am 
Offline

Joined: Tue Apr 05, 2016 11:23 am
Posts: 10
Hi there,

First of all thanks for clarifying that there is no way to import RTF to MigraDoc yet. This answers one of the questions I've had.

The other is: Is there any other way to import the content of a RichTextBox Control (WPF) to MigraDoc?

What I am doing right now is that I save the content of the control as XAML and import this to MigraDoc using a method I've written myself (quite a sophisticated and long method). But I have problems with my self-written method. For instance, if I copy formatted text from Microsoft Word and paste it into the RichTextBox Control, this will result in a slightly different markup. Formattings will not be inside <Run ...> tags but inside <Span ...> tags. I have adapted my code to cover this and yet it sometimes simply fails to convert formatted text containing passages copied and pasted from Microsoft Word. There may be a bug in my code which I have not found yet.

That is what makes me ask whether there is any other solution to import the content of a RichTextBoxControl (WPF) to MigraDoc.

Thank you in advance for your answer!


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

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 2 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:  
Powered by phpBB® Forum Software © phpBB Group