Aspose.Pdf 7.9 Document.Convert(Stream- PdfFormat- ConvertErrorAction)

I am running Aspose.Pdf 7.9 in .NET, and using it to convert PDF files in PDF format 1.3 into PDF format 1.5. I am calling the Document.Convert(Stream, PdfFormat, ConvertErrorAction) overload with a MemoryStream, PdfFormat.v_1_5, ConvertErrorAction.None. The documentation for this overload of Document.Convert says it will "save errors into the specified stream". I am trying to find out how I can programmatically determine whether the conversion operation encountered an error by examining what got saved into the stream after the method runs, but the documentation does not provide sufficient information to do that. I've determined that the Convert method disposes the Stream parameter, so it limits my options for reading the data back from a memory stream, but MemoryStream.ToArray() as a parameter into Encoding.Default.GetString(byte[]) seems to work as a way to get the data back. I've tried a few different PDF files into the Convert method, and in all of those tests, the data from the Stream has come back as:

1.0Copyright (c) 2001-2012 Aspose Pty Ltd. All Rights Reserved.5/28/2015 3:15:47 PM

That looks to me as if the log does not indicate an error, but that's just my assumption. I would like documentation or confirmation. Also, the "file" tag's "Name" attribute is "test.pdf", but that does not reflect the actual name of the file used in that Document's constructor; it's getting "test.pdf" as the "Name" in this log regardless of the file name passed in. If my assumption that this sample log would indicate a successful conversion is correct, what would change about it when conversion did encounter an error? Would it add additional content in the log? If it were to add some new tag to the log for every error, I could potentially test if the string contains that tag to determine if there was an error. Or, since the success log's content length seems like it would be pretty stable since dates only have small variations in the number of characters and the filename seems to always be "test.pdf" regardless of the real filename, I could potentially make a programmatic decision just based on the length of the content. But I also have no idea how to craft a file that would create one of these conversion errors, so I have no way to produce an example log of an error, thus I need documentation or a sample log with an error provided.

Hi Christopher,


Thanks for your inquiry. Please note Convert() method returns Boolean as conversion results. You can get the result and program your logic accordingly to identify the failed conversion details i.e. file name and log. Hopefully it will resolve your problem. Please share some more details If there is any difference in my understanding and your requirement.

Best Regards,

So any time there is an object within the PDF file that cannot be converted, the method will return false? We want to ensure that the conversion does not lose any of the PDF file's content, and if it would lose any content, we want to detect that scenario and handle it a specific way.

It is fine if a complete conversion error is treated the same as a conversion that partially loses content, but I want to be sure that a completely successful conversion can be handled differently than a conversion that partially loses content.

Hi Christopher,


Thanks for your feedback. Convert() method returns false for failed conversion either complete or some partial error. However to provide you exact information I am coordinating with the product team and will let you know exact behavior of Convert() method.


Best Regards