나는 흥미로운 문제에 직면 해있다. Syncfusion Essential Studio + Web Kit를 사용하여 HTML을 PDF로 변환합니다. 때로는 잘 작동하지만 때로는 완전히 쓸모가 없습니다.Syncfusion HTML을 PDF로 변환
완전히 쓸모가 없다는 것을 의미합니까? HtmlToPdfConverter의 Convert 메서드를 호출 할 때마다 UnauthorizedException이 throw됩니다. 그러나 매번 발생하지는 않으며 무작위로 나타납니다.
string htmlString = "";
try
{ // Open the text file using a stream reader.
using (StreamReader sr = new StreamReader("PdfTemplates\\template.html"))
{
// Read the stream to a string, and write the string to the console.
htmlString = sr.ReadToEnd();
}
}
catch (Exception e)
{
_logger.Error(e,"read the template html");
throw e;
}
StringBuilder sb = new StringBuilder(htmlString);
sb.Replace("%SOMETHING%", something);
htmlString = sb.ToString();
_logger.Information("htmltemplate with new data created");
PdfDocumentBase mergedPdf;
try
{
var pdfDocFromHtml = _htmlConverter.Convert(htmlString, ""); // THE Problematic line
var pdfLoadedDocument = new PdfLoadedDocument(uploadedPdfStream);
//template generation
_logger.Information("pdf created from html");
//merge the generated pdf with the uploaded document
mergedPdf = MergePdf(pdfDocFromHtml, pdfLoadedDocument);
_logger.Information("pdf merged");
var resultStream = PdfDocumentToStream(mergedPdf);
pdfDocFromHtml.Close(true);
pdfLoadedDocument.Close(true);
return resultStream;
}
catch (Exception ex)
{
Type typeOfE = ex.GetType();
_logger.Error(ex, "pdfLoadedDocument from byteArray");
throw;
}
내가 팀에서 작업하고, 팀 동료 중 아무도 나를 단지 문제가 없습니다 : 다음은 내 코드입니다. 나는 Windows 10 Pro를 사용 중입니다. 우리는 ASP.NET MVC 애플리케이션을 개발 중입니다.
누군가가 문제가 될 수있는 아이디어가 있습니까?
을 위해 일하지만,이 역시 실패했습니다. 나는 그 지원에 대해서도 연락 할 것이다. –