本文整理汇总了C#中IConverter.ConvertToPdf方法的典型用法代码示例。如果您正苦于以下问题:C# IConverter.ConvertToPdf方法的具体用法?C# IConverter.ConvertToPdf怎么用?C# IConverter.ConvertToPdf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConverter
的用法示例。
在下文中一共展示了IConverter.ConvertToPdf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: elaboraAllegato
private AllegatiElaborati? elaboraAllegato(DocumentInfo allegato, Persona persona, ParametriStampaUnione parametri, TipoMessaggio tipo, IConverter converter, int azienda)
{
AllegatiElaborati? result = null;
byte[] body;
if(persona != null)
parametri.IdPersona = persona.ID;
byte[] bodyAllegato = getBodyAllegato(allegato, parametri, azienda);
var fileExtension = allegato.FileExtension;
string fileName;
try
{
if (tipo != TipoMessaggio.Manuale && (string.IsNullOrEmpty(allegato.FileExtension) || allegato.FileExtension != ".pdf"))
{
body = converter.ConvertToPdf(allegato).ToArray();
fileExtension = ".pdf";
}
else
body = bodyAllegato;
fileName = allegato.FileName;
var index = fileName.LastIndexOf(".");
if (index > 0)
fileName = fileName.Substring(0, index);
}
catch (Exception)
{
body = bodyAllegato;
fileExtension = allegato.FileExtension;
fileName = allegato.FileName;
var index = fileName.LastIndexOf(".");
if (index > 0)
fileName = fileName.Substring(0, index);
}
var documentMessage = getDocumentService().SaveDocument(bodyAllegato, allegato.FileName, allegato.FileExtension, null, _info.Azienda);
if (documentMessage.Documento != null)
{
var documentoDto = documentMessage.Documento;
allegato.FileId = documentoDto.Checksum;
var documento = new DocumentInfo { Body = body, FileId = documentoDto.Checksum, FileName = fileName, FileExtension = fileExtension };
result = new AllegatiElaborati(documento, allegato);
}
return result;
}