PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Jan 15, 2021 6:04 pm

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: RTF Rendering
PostPosted: Thu Jul 11, 2019 1:18 pm 

Joined: Tue May 28, 2019 3:53 pm
Posts: 6
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.

Reply with quote  
 Post subject: Re: RTF Rendering
PostPosted: Thu Jul 11, 2019 2:08 pm 
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3047
Location: Cologne, Germany

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.

Thomas Hoevel
PDFsharp Team

Reply with quote  
 Post subject: Re: RTF Rendering
PostPosted: Thu Jul 11, 2019 4:07 pm 

Joined: Tue May 28, 2019 3:53 pm
Posts: 6
Thanks for the reply. I've not tried the latest. Was hoping you guys may see that we were doing something incorrectly.

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

All times are UTC

Who is online

Users browsing this forum: Google [Bot] and 14 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