PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

RTF/PDF/DDL to XPS?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3609
Page 1 of 1

Author:  MariusIonut [ Wed Jun 21, 2017 8:16 am ]
Post subject:  RTF/PDF/DDL to XPS?

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.

Author:  Thomas Hoevel [ Wed Jun 21, 2017 9:47 am ]
Post subject:  Re: RTF/PDF/DDL to XPS?

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.

Author:  MariusIonut [ Mon Jun 26, 2017 5:24 pm ]
Post subject:  Re: RTF/PDF/DDL to XPS?

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.

Author:  Entwickler582 [ Thu Apr 26, 2018 9:53 am ]
Post subject:  Re: RTF/PDF/DDL to XPS?

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!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/