title: ABCPDF Font Printing Layout - Machine Dependent
body: <p>I am using ABCPDF to print a PDF file to a local printer via EMF file. I've based this very closely on ABC PDF's sample "ABCPDFView" project. My application worked fine on my Windows 7 and Windows XP dev boxes, but when I moved to a Windows 2003 test box, simple embedded fonts (like Times New Roman 12) rendered completely wrong (wrong spot, and short and squat, almost like the DPI's were crazily wrong). </p>
  
  <p>Note that I've hardcoded the DPI to 240 here b/c I'm using a weird mainframe print driver that forces 240x240. I can discount that driver as the culprit as, if I save the EMF file locally during print, it shows the same layout problems. If I render to PNG or TIFF files, this looks just fine on all my servers using this same code (put .png in place of .emf). Finally, if I use the ABCPDFView project to manually add in a random text box to my PDF, that text also renders wrong in the EMF file. (Side note, if I print the PDF using Acrobat, the text renders just fine)</p>
  
  <p>Update: I left out a useful point for anyone else having this problem. I can work around the problem by setting RenderTextAsText to "0" (see code below). This forces ABCPDF to render the text as polygons and makes the problem go away. This isn't a great solution though, as it greatly increases the size of my EMF files, and those polygons don't render nearly as cleanly in my final print document.</p>
  
  <p>Anyone have any thoughts on the causes of this weird font problem?</p>
  
  <pre><code>private void DoPrintPage(object sender, PrintPageEventArgs e)
    {
        using (Graphics g = e.Graphics)
        {
          //... omitted code to determine the rect, used straight from ABC PDF sample
            mDoc.Rendering.DotsPerInch = 240 ;
            mDoc.Rendering.ColorSpace = "RGB";
            mDoc.Rendering.BitsPerChannel = 8;
            mDoc.SetInfo(0, "RenderTextAsText", "0");//the magic is right here
            byte[] theData = mDoc.Rendering.GetData(".emf");
            using (MemoryStream theStream = new MemoryStream(theData))
            {
                using (Metafile theEMF = new Metafile(theStream))
                {
                    g.DrawImage(theEMF, theRect);
                }
            }
            //... omitted code to move to the next page
        }
  </code></pre>