public HtmlDom GetDomForPrinting(PublishModel.BookletPortions bookletPortion, BookCollection currentBookCollection, BookServer bookServer)
{
var printingDom = GetBookDomWithStyleSheets("previewMode.css", "origami.css");
AddCreationTypeAttribute(printingDom);
if (IsFolio)
{
AddChildBookContentsToFolio(printingDom, currentBookCollection, bookServer);
printingDom.SortStyleSheetLinks();
}
//whereas the base is to our embedded server during editing, it's to the file folder
//when we make a PDF, because we wan the PDF to use the original hi-res versions
var pathSafeForWkHtml2Pdf = FileUtils.MakePathSafeFromEncodingProblems(FolderPath);
BookStorage.SetBaseForRelativePaths(printingDom, pathSafeForWkHtml2Pdf);
switch (bookletPortion)
{
case PublishModel.BookletPortions.AllPagesNoBooklet:
break;
case PublishModel.BookletPortions.BookletCover:
DeletePages(printingDom.RawDom, p => !p.GetAttribute("class").ToLowerInvariant().Contains("cover"));
break;
case PublishModel.BookletPortions.BookletPages:
DeletePages(printingDom.RawDom, p => p.GetAttribute("class").ToLowerInvariant().Contains("cover"));
break;
default:
throw new ArgumentOutOfRangeException("bookletPortion");
}
AddCoverColor(printingDom, Color.White);
AddPreviewJavascript(printingDom);
return printingDom;
}