public static int ConvertHtmlSringBdsProductToPdf(string name, Guid idDocumentModel, string destinationPath, Guid idUser, FirmInstitutionViewModel firmCGP, Guid? idDocument, bool forceDownload, string logoUrl = "") { int pageCount = 0; Byte[] documentBytes = null; try { DocumentModel documentModel = GetDocumentModelFromId(idDocumentModel); if (documentModel != null && idDocument.HasValue) { string strHtmlMapped = null; string strFooter = null; var model = EntityToModel(documentModel); strHtmlMapped = AppendIntoBodyHtml(model.HtmlTemplate); //strHtmlMapped = AppendIntoBodyHtml(documentModel.HtmlTemplate); ExpertPDFHelper expertPdfEngine = new ExpertPDFHelper(); documentBytes = expertPdfEngine.GeneratePdfBytesUsingComponent(ParserHtmlMethod(documentModel, idDocument.Value, strHtmlMapped, logoUrl, true, firmCGP), name, strFooter, false); FoxitPDFGenerator pdfGen = new FoxitPDFGenerator(); string docTitle = string.Empty; //TODO : multilingue string ownerName = name; pdfGen.GenerateMergeByteDocument(documentModel.IdDocumentModel, documentBytes, destinationPath, "", forceDownload, out pageCount, Upsilab.Business.Document.ElectronicSafeDocumentBL.DocumentType.SF.ToString(), "center", docTitle, ownerName,false,false); } } catch (Exception ex) { throw new Exception(string.Format("Erreur lors de la génération du template HTML en PDF : {0}", ex.Message)); } return pageCount; }