title: How to pass from .NET PrintDocument to PDFsharp print?
body: <p>I have a lot of instructions to print a text file using the PrintDocument class of .NET. You can pretend my code is this -> <a href="https://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx?cs-save-lang=1&amp;cs-lang=vb#code-snippet-2" rel="nofollow">https://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx?cs-save-lang=1&amp;cs-lang=vb#code-snippet-2</a>. In that code you see only a DrawString image, but I have a lot of instructions since the document is more complex.</p>
  
  <p>I want to convert my text file to PDF so I chose PDFsharp (I like their MIT license since it's for a commercial product).</p>
  
  <p>Now I can't figure out how to modify my code to use PDFsharp. I don't want to use their "X" Classes (XFont, XSize, ...) since I need to replace all the occurrences in my big source code. If sometimes in the future I want to change PDFsharp for something else, I don't want to rewrite my source code because they have "ABC" Class (ABCFont, ABCSize,...).</p>
  
  <p>Neither I want 2 methods of printing: PrintWithDotNet and PrintWithPdfSharp with all the code nearly the same (new Font vs new XFont, ...). It would be a debug nightmare.</p>
  
  <p>I prefer not to write adapters or make use of bridge pattern: too much classes to create.</p>
  
  <p>It seems strange that PDFsharp's developer didn't think of an easy way to pass from standard .NET printing to PDFsharp printing... or I have not found it?</p>
  
  <p>Thanks in advance for your suggestions.</p>