When I take the line out the fonts do get embedded and everything works fine..
- Code: Select all
private static void SaveToStream(Document wordDocument, string reportName, Stream stream)
{
var mStream = new MemoryStream();
ToPdfParameterList toPdf = new ToPdfParameterList();
//toPdf.UsePSCoversion = true; //added at suggestion of spire tech support to fix website gdi error.
toPdf.EmbeddedFontNameList.Add("Letter Gothic");
toPdf.PrivateFontPaths.Add(new PrivateFontPath("Letter Gothic", FontStyle.Regular, "LETGOT.TTF"));
toPdf.PrivateFontPaths.Add(new PrivateFontPath("Letter Gothic", FontStyle.Bold, "LETGOTB.TTF"));
toPdf.CreateWordBookmarks = true;
toPdf.WordBookmarksTitle = reportName;
toPdf.WordBookmarksColor = Color.Red;
toPdf.WordBookmarksTextStyle = BookmarkTextStyle.Bold;
wordDocument.BookmarkLayout += document_BookmarkLayout;
wordDocument.SaveToStream(mStream, toPdf);
//now opend it backup and enable the bookmarks to be visible in the browser.
PdfDocument pdfdoc = new PdfDocument();
pdfdoc.LoadFromStream(mStream);
pdfdoc.ViewerPreferences.FitWindow = true;
pdfdoc.ViewerPreferences.PageMode = PdfPageMode.UseOutlines;
pdfdoc.SaveToStream(stream);
stream.Flush();
wordDocument.Close();
}