Will GroupDocs.Conversion supports to convert any bytestream to pdfbytes

Hi Team,

I have been working with GroupDocs.Conversion Nuget package and it is pretty much cool software to convert to any type of file to pdf type. But we also have a situation where we have file (doc,docx,tif,tiff,png,jpg) in bytes and we need to convert this bytes to pdfbytes.

To give more context, From our application user will be able to upload the document from his local machine. So once he uploads any kind of file format documents , app basically converts to bytes and passes to the service layer. So we need a mechanism to convert the bytes to pdfbytes and then store in our fileshare.

Please let me know is there any method that is exposed to do this process.

Thanks
Vamshi Mukka


This Topic is created by vladimir.litvinchik using Email to Topic tool.

@vamshie8wdq63

We are investigating this scenario. Your investigation ticket ID is CONVERSIONNET-5229.

@Atir_Tahir, I know you guys are working on this. But just would like to follow-up on it. Is there any progress on this and what would be an ETA?

@vamshie8wdq63

This issue is still under investigation. As there’s any progress update, you’ll be notified.

@Atir_Tahir, Its been quite sometime , i haven’t heard back from you guys? Are you still working on this ?

@vamshie8wdq63

I am afraid but this ticket is still under investigation.

@vamshie8wdq63

Please take a look at the following workaround:

const string sourceFileName = "one-page.docx";
using (var sourceStream = new FileStream(sourceFileName, FileMode.Open))
{
    using (var converter = new Converter(() => sourceStream))
    {
        var convertOptions = new PdfConvertOptions();
        using (var outputStream = new MemoryStream())
        {
            converter.Convert(() => new MemoryStream(), (convertedStream, _) => convertedStream.CopyTo(outputStream), convertOptions);
            var convertedBytes = outputStream.ToArray();
            ....
        }
    }
}

Even simpler without intermediate MemoryStream:

const string sourceFileName = "one-page.docx";
using (var sourceStream = new FileStream(sourceFileName, FileMode.Open))
{
    using (var converter = new Converter(() => sourceStream))
    {
        var convertOptions = new PdfConvertOptions();
        byte[] convertedBytes;
        converter.Convert(() => new MemoryStream(), (convertedStream, _) => convertedBytes = ((MemoryStream)convertedStream).ToArray(), convertOptions);
    }
}