We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Red Cross replacing header image in Word to PDF conversion

Hello

We currently generate hundred of PDFs a day which are converted from .doc or .docx files. All of these docs have a header image or letterhead and the majority work fine.
However every now and then (maybe once a month) we get a file come out with a red cross replacing the image.
I have no way of replicating this issue and am not getting any errors thrown.

My code is fairly simple and looks like below.

var memoryStream = new MemoryStream();
var doc = new Aspose.Words.Document(new MemoryStream(inputDocxByteArray));
doc.Save(memoryStream, Words.Saving.SaveOptions.CreateSaveOptions(SaveFormat.Pdf));
var outputPdfByteArray = memoryStream.ToArray();

As mentioned above this works 99.99% of the time but sometimes the red cross appears. (See image.png attached)

I understand no one will be able to replicate this with the above code so I was hoping for 2 things:

  • Has anyone else experienced this issue recently? That last post I could find was from 2016 and it has not solved my problem.
  • Could an Aspose support person explain why/when/how the red cross could appear at all (as in what conditions could cause it to appear). Then maybe I can check if those conditions are occurring in my instance and fix from there.

image.png (1.5 KB)

@TSPLITOPS, could you please attach a sample document that you are observing the issue with?

What are you looking to investigate? Just because the one I have on hand contains personal identifiable information of one of our customers so I cannot share it.

I could provide a screen shot of the whole PDF redacted. I will also contact the support team to see if we have an example from our testing environment with scrambled data.

@TSPLITOPS, First of all, the “red cross” is inserted in case there is some problem with the image. I would like to check how the image is stored in the document. It might be an online image, and you get the “red cross” because there is some network issue while the rendering to PDF happens. There might other problems with the images, but it is hard to guess without having the document.

Regarding your concerns about the personal information, the attached files are accessible on the forum by you and our support team only. If this is still a problem, please remove the personal information from the document before attaching it.

Screenshots most likely won’t help to analyze the issue.

Please find attached an example input and output.

ExampleInput.docx (123.9 KB)
ExampleOutput.pdf (52.2 KB)

@TSPLITOPS, Your issue has been logged as WORDSNET-23585. We will let you know once the development team analyzes it.

@TSPLITOPS, here is the reply from the development team:

The image with a red cross is the default image, which is used in case of failure to read the original image. This may be caused by memory problems (for example, overflow), access to a resource on disk (may be problems with multi-threaded access) or network, structural damage, or inconsistency with supported image formats.
Based on the fact that the customer is rendering documents with a supported image format and without problems accessing resources, it can be assumed that this is somehow related to problems with the server’s memory.

I would recommend looking into warnings. Maybe there will be something like “Not enough memory to load the image” or “Image can not be processed. Possibly unsupported image format”.

Could you try to catch any memory-related problem and let us know whether it causes the red-cross image?