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

Free Support Forum - aspose.com

Converting Word to PFD using Memory Stream outputs to Square Boxes

Hello,

I have a word document i am converting it to PDF as below.

public MemoryStream ConvertWordToPDF(MemoryStream stream)
{
    MemoryStream pdfStream = new MemoryStream();
    // Create a new memory stream.
    MemoryStream outStream = new MemoryStream();
    try
    {
        Document doc = new Document(stream);
        // Save the document to stream.
        doc.Save(outStream, Aspose.Words.SaveFormat.Pdf);

        // Convert the document to byte form.
        byte[] docBytes = outStream.ToArray();

        // The bytes are now ready to be stored/transmitted.
        // Now reverse the steps to load the bytes back into a document object.
        pdfStream = new MemoryStream(docBytes);
    }
    catch
    {
        // wordLicense.SetLicense("");
        // pdfLicense.SetLicense("");
    }
    finally
    {
        stream.Close();
        outStream.Close();
    }
    return pdfStream;
}

The PDF generated through aspose is having square boxes while the word file which i am converting looks fine. See the attached word and PDF file.
Please let me know the solution for this.

Hi Rob,

Thanks for your inquiry. I have tested the scenario using latest version of Aspose.Words for .NET 14.10.0 and have not found the shared issue. Please use Aspose.Words for .NET 14.10.0. I have attached the output Pdf document with this post for your kind reference.