Hi
We have some code that reads some stored documents from a database adds a stamped footer and then outputs a file.
I have attached the original file, and the file that is outputted, for some reason the Textbox is getting cut off and I can’t figure out why, even if I simple to a read with Aspose.Words and SaveAs to the stream this happens so I am not sure if this is a bug or something else?
The code we are using to output the file is like so:
private byte[] ConvertToBytes(AP.SaveFormat saveFormat, AP.Document asposeDoc)
{
//saves the document to a byte array without converting to PDF
var outStream = new System.IO.MemoryStream();
var saveOptions = AP.Saving.SaveOptions.CreateSaveOptions(saveFormat);
if (saveFormat == AP.SaveFormat.Pdf)
{
var pdfOptions = new AP.Saving.PdfSaveOptions();
pdfOptions.PreserveFormFields = true;
saveOptions = pdfOptions;
}
asposeDoc.Save(outStream, saveOptions);
var bytes = new Byte[outStream.Length];
bytes = outStream.ToArray();
return bytes;
}
Reading the document from the database using :
asposeDoc = new AP.Document(file.OutputStream);
asposeDoc = new AP.Document(file.OutputStream);
And then outputting to the browser with:
context.Response.OutputStream.Write(bytes, 0, bytes.Length);
//if set explicitly to not attach or is a Visio file, (Visio 2000 has a problem with not opening inline)
var displayType = “attachment;”;
if (containsHash || System.IO.Path.GetExtension(fileName).ToLower() == “.vsd”)
displayType = “inline;”;
context.Response.AddHeader(“content-disposition”, displayType + “filename=” + HttpUtility.UrlEncode(fileName));
//set the cache from date.
if (lastModified != DateTime.MinValue && lastModified < DateTime.Now)
context.Response.Cache.SetLastModified(lastModified);
context.Response.End();
I had to cut down the code a bit as there are some database specific checks it does. If you need anymore info please let me know.
Aspose.Words We are using 11.8.0 for .Net 4.
Thanks
Sean