#
#
#2019-04-03 14:47:34
C++ / C#
#, 2019-04-03 14:47:34

RTF to PDF conversion in C#, strictly free components, who knows about them?

subject actually. nothing special to add. So far, only COM automation of ArcobatRider has been found. bummer, there is about the components of the combat Acrobat, and not the reader,
I will be grateful for the tips, if anyone knows

Answer the question

In order to leave comments, you need to log in

3 answer(s)
#
#, 2019-04-04
@mindtester

as a result of intensive searches, I have to admit that all completely free tools try to render to html and only then to pdf
if, according to the conditions of the task, I am allowed to use the upd office - it all comes down to automating the print job to a pdf printer. if not, let's simplify the task to rendering html, and it's not forbidden to use browsers for sure))

turned out even easier))
internal static bool wordAsConverter(string rtf, string pdf, bool verb = true, bool clean = true)
{
  $"\t..try convert to pdf...".print();
  var res = false;
  var app = new Application();
  try
  {
    var doc = app.Documents.Open(rtf);
    doc.ExportAsFixedFormat(pdf, WdExportFormat.wdExportFormatPDF);
    doc.Close(false);
    res = true;
    var fn = Path.GetFileName(rtf);
    if (verb) $"\t{fn} converted to pdf".print();
    if (clean)
    {
      File.Delete(rtf);
      if (verb) $"\t{fn} deleted".print();
    }
  }
  catch (Exception e) { e.Message.print(); }
  finally { app.Quit(false); }
  return res;
}
// привычка, для уменьшения многословности кода
internal static void print(this string s) => Console.WriteLine(s);

thank you all for participating!

M
mshak, 2019-04-03
@mshak

consider the MigraDoc & pdfSharp option, if my memory serves me, then the MIT license

S
sergey, 2019-04-03
kuzmin @sergueik

https://github.com/dotnetcore/NPOI ?
NOTE: I haven't tried "N" myself, only *straight* poi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question