PDFsharp & MigraDoc Foundation

RTF Rendering
Page 1 of 1

Author:  jrk [ Thu Jul 11, 2019 1:18 pm ]
Post subject:  RTF Rendering

My apologies if this post is in the incorrect forum.
We are new to this tool, but have been pretty successful in our very basic use of Migradoc at this point...still plenty to learn. But we seem to have run into a small issue and wondering if there is a way to address.

1. We create a very simple document, created as a Migradoc document, which at this stage only shows .png images. These .png images are temporarily written to disk for the sole purpose of importing them as images into the document. We have used the base64 memory import, but find writing to disk...although more disk operation, is less intensive.

2. We successfully render the document as a PDF using the PDF Render as well as an RTF document using the RTF Render, based on what the user wants to see.

3. After rendering the document as PDF, we can successfully remove the temporary .png files on disk.

4. After rendering the document as an RTF, these temporary files are not release from the rendering process and we cannot remove.

We are using the following versions:
MigraDoc.RtfRendering, Version=1.32.3885.0
MigraDoc.Rendering, Version=1.32.3885.0
PdfSharp, Version=1.32.2608.0

Image import coding currently used:
cImageName = DashboardObject:Caption.
ImageFile = NEW System.IO.FileInfo("C:\temp\image.png").

FileStream = NEW System.IO.FileStream(ImageFile:FullName, System.IO.FileMode:OpenOrCreate).
FileStream:Write(ObjectBytes, 0, ObjectBytes:Length).

MDImage = DocumentSection:AddImage(ImageFile:FullName).
MDImage:LockAspectRatio = TRUE.
MDImage:WIDTH = MigraDoc.DocumentObjectModel.Unit:FromCm(16).

PDF Rendering:
PDFRenderer = NEW MigraDoc.Rendering.PdfDocumentRenderer(FALSE, PdfSharp.Pdf.PdfFontEmbedding:Always).
PDFRenderer:Document = Document.

All temporary image .png files are successfully removed after this.

RTF Rendering:
RTFRenderer = NEW MigraDoc.RtfRendering.RtfDocumentRenderer().
RTFRenderer:Render(Document, RTFFile:FullName, ?).

All files are locked down and cannot be removed.

Are we using the latter incorrectly? Is there a set of methods or properties we can call/set to get the RTF Rendering to release use of these files?

We appreciate the help.

Author:  Thomas Hoevel [ Thu Jul 11, 2019 2:08 pm ]
Post subject:  Re: RTF Rendering


This could be a bug in the RTF Renderer.
Have you tried the latest stable version 1.50?

BASE64 does not yet work with RTF yet. It does not work at all with version 1.32.

Author:  jrk [ Thu Jul 11, 2019 4:07 pm ]
Post subject:  Re: RTF Rendering

Thanks for the reply. I've not tried the latest. Was hoping you guys may see that we were doing something incorrectly.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group