I am having trouble with aspose words saving files to the web. This seems like a really old problem as I have reported it before but here is the scenario.
I have a word document (docx) that I am using as a template file. I open the file programmatically and replace some text and images and then save the file to the web as a pdf file. The pdf file opens fine in Chrome but Adobe Acrobat says the file is broken and can’t be opened.
I tried several other tests as well:
Open the template file (docx) and save it directly as a pdf without doing any replace operations. Chrome OK, Acrobat broken.
Open the template file (docx), do the replace and save as a docx. Word reports that the file is corrupted but will open it.
Open the template file (docx) do no replacements and save as a docs. Word reports that the file is corrupted but will open it.
Change the template file to a .doc file from .docx and do the same tests.
Open the template file (doc) do the replacements and save as a pdf. Chrome OK, Acrobat broken.
Open the template file (doc) and save it directly as a pdf without doing any replace operations. Chrome OK, Acrobat broken.
Open the template file (doc), do the replace and save as a doc. Word opens fine.
Open the template file (doc) do no replacements and save as a docs. Word opens fine.
My conclusion is that you still can’t use a docx file in Aspose as a template file which is OK but I had hoped you would have fixed this by now. I think I first reported this at least 8 years go.
However, I do need help to get the pdf to be readable in Acrobat. I have attached the docx file, the doc file and a sample pdf output file.
I am using the following code to save the document to the web.
string fileName = string.Format("scenario{0}.pdf", id);
context.Response.Clear();
d.Save(context.Response, fileName, ContentDisposition.Attachment, new Aspose.Words.Saving.PdfSaveOptions { ColorMode = Aspose.Words.Saving.ColorMode.Normal });
context.ApplicationInstance.CompleteRequest();
Please help.
Thanks.
scenario4 (57).pdf (212.6 KB)
scenario_export_template.zip (1.8 MB)