none
Substituted fonts and Word Automation RRS feed

  • Question

  • I have a word document that uses a nonstandard font. It's not embedded but is installed on the machine in question. In Word 2010, when I print that to a post script file while specifying a certain printer driver, that font gets embedded (subset) just fine. That's if I do it from the Word application itself.

    If I try to do it programmatically using msword::_Document::Printout and specifying the same printer driver, the font in question gets subsituted with something else. I know the same printer driver is being used in both cases. The .ps files generated for both methods list the printer drivers name at the top. Is there some reason going through automation this way would substitute the font but going through the app itself does not?

    CComVariant vIgnore; 
    vIgnore.vt = VT_ERROR;
    vIgnore.scode = DISP_E_PARAMNOTFOUND;
    
    CComVariant vFalse = false;
    CComVariant vTrue = true;
    CComVariant vOutputFile(m_csTempOutputFile);
    CComVariant vOneCopy((int)1);  
    
     ...
     ....
    
     m_piApp->SetActivePrinter( (LPCTSTR) csPrinterName); 
    
     m_Doc.PrintOut(
            &vFalse,//Background, return control while printing? FALSE
            &vFalse,//Append, append output to existing file? FALSE, overwrite file
            &vIgnore,//Range, the page range
            &vOutputFile,//OutputFileName, name of printtofile file
            &vIgnore,//From, starting page (ignored)
            &vIgnore,//To, ending page (ignored)
            &vIgnore,//Item, what content to print, DEFAULT
            &vOneCopy,//Copies, number of
            &vIgnore,//Pages, page range
            &vIgnore,//PageType, even only, odd only, etc
            &vTrue,//PrintToFile, TRUE
            &vIgnore,//Collate,
            &vIgnore,//ActivePrinterMacGX, (mac feature only)
            &vIgnore,//ManualDuplexPrint,
            &vIgnore,//PrintZoomColumn, (printing several pages on one page)
            &vIgnore,//PrintZoomRow,
            &vIgnore,//PrintZoomPaperWidth,
            &vIgnore);//PrintZoomPaperHeight,
    Thursday, May 17, 2012 7:39 PM

Answers

All replies

  • Hi Daniel,

    Does this happen when using standard fonts?

    Thanks.

    Monday, May 21, 2012 9:31 AM
  • Does not happen when using standard fonts. And interestingly, if instead of Printout, I use the _Doccument::SaveAs API to .pdf - again the font is substituted.

    If I do save as to pdf from within Word, the font gets in just fine.  

    Monday, May 21, 2012 1:08 PM
  • In some of the cases where I have seen this, all I had to do was reboot the server after installing the true type font. This was not the case for all my machines, but if you run into something similar, it's something to try.

    http://www.idautomation.com/kb/ttf-printing.html

    • Marked as answer by Daniel Grillo Wednesday, May 30, 2012 7:55 PM
    Wednesday, May 30, 2012 7:55 PM