Hi GroupDocs,
We’re running into an issue that seems to occur when converting .RTF documents with tiny left/right margins to PDF. Part of the document gets cut off when you try to view it in Adobe Reader after conversion. The same does not happen if you convert the .RTF to .PDF via Microsoft Word.
Here is our code:
public async Task<Stream> RenderDocumentAsPdfAsync(Stream document, string documentName)
{
Guard.ArgumentNotNull(document,“document”);
Guard.ArgumentNotNullOrEmpty(documentName, “documentName”);
var config = GetViewerConfig();
var imgHandler = new ViewerImageHandler(config);
var pdfOptions = GetPdfOptions();
var fileContainer = new FileContainer();
try
{
var memoryStream = new MemoryStream();
await document.CopyToAsync(memoryStream);
fileContainer = await Task.Run(() => imgHandler.GetPdfFile(memoryStream, pdfOptions));
}
catch (Exception ex)
{
ApplicationLogger.LogError(string.Format("Conversion of document {0} to PDF failed. Exception: {1}", documentName, ex.ToString()),
MethodBase.GetCurrentMethod(), exception: ex);
return null;
}
return fileContainer.Stream;
private static ViewerConfig GetViewerConfig()
{
var config = new ViewerConfig()
{
UseCache = false,
};
return config;
}
GroupDocs Viewer version is at 17.8. I’m attaching a specific file that the issue occurs with
Please let me know if any other info is needed!
Adjusting Journal Entries-10_10 JO.pdf (66.6 KB)
Best,
Brett