public byte[] CreatePdfContent(Printable printable) { _issueReport = new Dictionary <string, string>(); // the prince converter optimized for boom templates var converter = new BoomConverter(); converter.IssueReport += converter_IssueReport; // TODO: Add dynamic modifications to final document here var html = converter.GenerateHtml(printable, Printable.TemplatePartial.DocumentXml); return(MakePdf(html)); }
public string CreateHtml(Printable printable) { _printable = printable; _issueReport = new Dictionary <string, string>(); // first we get the container template var converter = new BoomConverter(); converter.IssueReport += converter_IssueReport; // TODO: Add dynamic modifications to final document here var html = converter.GenerateHtml(printable, Printable.TemplatePartial.DocumentXml); return(html); }
public byte[] CreatePdfCover(Printable printable) { var coverTpl = Encoding.UTF8.GetString(printable.Templates.Single(t => t.InternalName == Printable.TemplatePartial.BookCover).Content); var tempFiles = new List <string>(); // create and write cover background var coverImg = Path.Combine(printable.TempStorePath, "bg" + Guid.NewGuid() + ".png"); using (var coverFile = File.Create(coverImg)) { coverFile.Write(printable.CoverImage, 0, printable.CoverImage.Length); } tempFiles.Add(coverImg); // create and write QR code // TODO: Make this dynamic with additional data // create and write barcode, if needed byte[] barcodeImg = null; if (printable.HasIsbn) { barcodeImg = GetBarCode(printable.Isbn, 158, 77, printable.Title); } string bio = null; if (printable.AdditionalAuthorInfo.Any()) { bio = String.Join(" ", printable.AdditionalAuthorBiographies.ToArray()); } var publishedAuthors = ""; if (printable.AdditionalAuthorInfo.Any()) { publishedAuthors = String.Join(", ", printable.AdditionalAuthorInfo.ToArray()); } if (printable.PermaLink != null) { printable.Updatelink = String.Format(WebConfigurationManager.AppSettings["production:CoverPermaLink"], printable.PermaLink); printable.QRImg = CreateQRCode(printable.Updatelink); } printable.BarCodeImg = barcodeImg; printable.CoverImg = coverImg; printable.HasToc = false; printable.HasIndex = false; printable.HasImprint = false; var bc = new BoomConverter(); var html = bc.GenerateHtml(printable, Printable.TemplatePartial.BookCover); return(MakePdf(html)); }