I am trying to save form output to HttpResponse.OutputStream.
But I am getting “Specified Method is not supported” exception. (Refer to the attachment)
I am in process of converting old Aspose.Pdf.Kit to new Aspose.Pdf release on 4/1/2014.
I was able to save to the Response.OutputStream when I was using PDF Kit but the Aspose.Pdf.Facade.Form method doesn’t allow me to save. Is this a bug? And is there a workaround to this problem?
Thanks,
Here is the code.
public void FillTemplate(string pdfTemplate)
{
string fname = Guid.NewGuid().ToString();
string fname1 = fname + “_1.pdf”;
fname = fname + “.pdf”;
string srcFile = Path.Combine(_context.Request.PhysicalApplicationPath,
string.Format(@"{0}{1}", TempOutput, fname1));
string destFile = Path.Combine(_context.Request.PhysicalApplicationPath,
string.Format(@"{0}{1}", TempOutput, fname));
if (!Directory.Exists(Path.GetDirectoryName(srcFile)))
Directory.CreateDirectory(Path.GetDirectoryName(srcFile));
var pdfFileStamp = new PdfFileStamp(pdfTemplate, srcFile);
AddWLNumberToFooters(pdfFileStamp);
var clientCore = new ClientCore(_queryArg.UserSession.GetConnectionString(), _queryArg.ClientId);
var core = new HILFSCore(_queryArg.UserSession.GetConnectionString(), _queryArg.Login);
var sheet = core.FormGet(clientCore.GetSheetIdForClient());
var srcDoc = new Document(srcFile);
var formEditor = new FormEditor(srcDoc) { Facade = new FormFieldFacade { FontSize = 8F } };
bool shouldLockForm = sheet.DataEntryCompleted.HasValue;
AddSubmitButtons(formEditor, new PdfFileInfo(srcFile).Document.Pages.Count, shouldLockForm);
LockGeneralInfo(formEditor, new HILFSGeneralInfo());
formEditor.Save(destFile);
//formEditor = new Kit.FormEditor(new FileStream(destFile, FileMode.Open), _context.Response.OutputStream)
// { Facade = new Kit.FormFieldFacade { FontSize = 8F } };
var form = new Form(destFile);
FillForm(form, sheet);
if (sheet.DataEntryCompleted != null)
LockForm(form);
//formEditor.Save(destFile);
//formEditor.Save();
form.Save(_context.Response.OutputStream);
}
We have a licence and support for the latest Apose products (Aspose.Total).