Windows 64
Spire.Doc 12.10.13
Spire.pdf 10.11.1
c# Console App
When I convert a word doc to a pdf, it does not look like it is respecting the CR LF in the word doc.
Attached are 3 files.
The word doc.
The pdf doc before we upgraded.
the pdf after we upgraded.
- Code: Select all
private static void SaveToStream(Spire.Doc.Document wordDocument, string reportName, Stream stream)
{
var mStream = new MemoryStream();
var pdfParams = GetPdfParameterList(reportName);
wordDocument.BookmarkLayout += document_BookmarkLayout;
wordDocument.SaveToStream(mStream, pdfParams);
//now opend it backup and enable the bookmarks to be visible in the browser.
var pdfdoc = new PdfDocument();
pdfdoc.LoadFromStream(mStream);
pdfdoc.ViewerPreferences.FitWindow = true;
pdfdoc.ViewerPreferences.PageMode = PdfPageMode.UseOutlines;
pdfdoc.SaveToStream(stream);
stream.Flush();
wordDocument.Close();
}
private static ToPdfParameterList GetPdfParameterList(string reportName)
{
var pdfParams = new ToPdfParameterList();
// pdfParams.EmbeddedFontNameList.Add("Letter Gothic");
//This works. When testing remember we have a Group policy that installs the font to your fonts folder every 30 min or so.
//pdfParams.PrivateFontPaths = new List<PrivateFontPath>() { new PrivateFontPath("LetGoth", @"c:\temp\_fonts\LETGOT.TTF") };
//TPS - The font is added to the project and marked as "Content" and Always copy. Shooting for the font to land in the final deployed bin/exe folder.
pdfParams.PrivateFontPaths = new List<PrivateFontPath>() { new PrivateFontPath("LetGoth", "LETGOT.TTF") };
//toPdf.UsePSCoversion = true; //added at suggestion of spire tech support to fix website gdi error. Adding this causes the below font additions to fail.
//can't use PSConversion on web per this tech support forum.
//https://www.e-iceblue.com/forum/topdf-usepscoversion-true-causes-font-issue-t7016.html
//pdfParams.PrivateFontPaths.Add(new PrivateFontPath("Letter Gothic", FontStyle.Regular, "LETGOT.TTF"));
//pdfParams.PrivateFontPaths.Add(new PrivateFontPath("Letter Gothic", FontStyle.Bold, "LETGOTB.TTF"));
pdfParams.CreateWordBookmarks = true;
pdfParams.WordBookmarksTitle = reportName;
pdfParams.WordBookmarksColor = Color.Red;
pdfParams.WordBookmarksTextStyle = BookmarkTextStyle.Bold;
return pdfParams;
}