We are converting HTML to PDF file using Aspose.words. In PDF document we see wrong positioned images. I have attached Source HTML file and Output PDF file for your reference.
This is happening in our production site where the customers are waiting for the fix.
Please provide us if there’s any workaround.
Following is the code snippet we used for conversion-
Document wordDoc = new Document(docStream);
DetectDocTypeAndSetPageSize(info, wordDoc);
try
{
_logger.LogInformation("DocumentConversion.ConvertStreamDocToPDFStreamAcceptDefaults - Remove Left Brackets");
FindReplaceOptions replaceOptions = new FindReplaceOptions();
replaceOptions.MatchCase = false;
replaceOptions.FindWholeWordsOnly = false;
wordDoc.Range.Replace("[", "", replaceOptions);
_logger.LogInformation("DocumentConversion.ConvertStreamDocToPDFStreamAcceptDefaults - Remove Right Brackets");
wordDoc.Range.Replace("]", "", replaceOptions);
_logger.LogInformation("DocumentConversion.ConvertStreamDocToPDFStreamAcceptDefaults - Before : wordDoc.Save(convertedObjstream, saveOptions);");
wordDoc.Save(convertedObjstream, pdfsaveOptions);
convertedObjstream.Position = 0;
_outPutStream = new byte[convertedObjstream.Length];
_logger.LogInformation("DocumentConversion.ConvertStreamDocToPDFStreamAcceptDefaults - Before : convertedObjstream.Read(_outPutStreamBytes, 0, (int)convertedObjstream.Length);");
convertedObjstream.Read(_outPutStream, 0, (int)convertedObjstream.Length);
if (convertedObjstream.Length > 0)
{
success = true;
}
}
catch (Exception e)
{
// trap the exeception
string errorMsg = "DocumentConversion - C# ConvertStreamDocToPDFStreamAcceptDefaults: Exception :\n\n" + e.Message + "\n\nStack Trace:\n" + e.StackTrace;
_logger.LogInformation(errorMsg);
}
Test.zip (144.8 KB)