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

Free Support Forum - aspose.com

ASPOSE Importfdf not working in release mode

Hi,

We are using the latest version (6.0.0) of ASPOSE.pdf.

we are using the FACADES namespace to merge the fdf and pdf data.

All the code to merge and contatenate is placed in a web service and are being used by the web application.

we are resulting in an error with the following stack trace

Error happened during parsing  at .?.a(Int32 startPosition, Int32& endPosition)
at ..()
at ?..a()
at ?..(? fontDefinition)
at ?..(String standardFontName)
at ..a()
at ..()
at Aspose.Pdf.Text.Font.a( trailerable, iPdfFont)
at Aspose.Pdf.Text.FontCollection..ctor( fontsDictionary)
at Aspose.Pdf.Resources..ctor(Object parent)
at Aspose.Pdf.XForm.get_Resources()
at Aspose.Pdf.InteractiveFeatures.Forms.TextBoxField.createAppearanceProgram(AppearanceParameters parameters, Annotation annotation)
at Aspose.Pdf.InteractiveFeatures.Annotations.WidgetAnnotation.a(Annotation annotation)
at Aspose.Pdf.InteractiveFeatures.Forms.Field.a()
at Aspose.Pdf.InteractiveFeatures.Forms.Field.setValue(String value)
at Aspose.Pdf.InteractiveFeatures.Forms.TextBoxField.set_Value(String value)
at Aspose.Pdf.Facades.Form.a(? source, ICollection dest, String xfaPath)
at Aspose.Pdf.Facades.Form.ImportFdf(Stream inputFdfStream)

We observe that this problem occurs only when the compilation debug mode of the services holding all these code is set to "Release". And the problems do not occur when the debug mode is set "Debug" and we are able to produce the pdf successfully after merging using ASPOSE.

Following is the code snippet of our code that users

//use Aspose to generte PDF from PDFImage and FDF_PDF

Stream[] fdf_pdfStream = new MemoryStream[pagecount];

pdfImage = (byte[])DetailRow["PDFImage"];

for (int count = 0; count < pagecount; count++)

{

Stream pdfImageStream = new MemoryStream(pdfImage);

DetailRow = Details.Tables[0].Rows[count];

fdf_pdf = (byte[])DetailRow["FDF_PDF"];

fdf_pdfStream[count] = new MemoryStream(fdf_pdf);

abcPDFStream[count] = new MemoryStream();

//2. Create Aspose Form instance with input stream and destination stream

Form pdfForm = new Form(pdfImageStream, abcPDFStream[count]);

//3. Import the contents of the fields in PDF template from the fdf_pdf byte[] and put them into new PDF stream abcPDFStream.

pdfForm.ImportFdf(fdf_pdfStream[count]);

pdfForm.Save();

//4. Retrieve byte[] from generated PDF stream (abcPDFStream)

abcPDFStream[count].Seek(0, SeekOrigin.Begin);

}

for (int count = 0; count < pagecount; count++)

{

fdf_pdfStream[count].Dispose();

fdf_pdfStream[count].Close();

}

}

PdfFileEditor pdfEditor = new PdfFileEditor();

using (Stream abcPDFoutputStream = new MemoryStream())

{

pdfEditor.Concatenate(abcPDFStream, abcPDFoutputStream);

abcPDFoutputStream.Seek(0, SeekOrigin.Begin);

abcPDF = new byte[(int)abcPDFoutputStream.Length];

abcPDFoutputStream.Read(abcPDF, 0, (int)abcPDFoutputStream.Length);

}

for (int count = 0; count < pagecount; count++)

{

abcPDFStream[count].Close();

}

return abcPDF;

Can you please work on this.

Hello Rafael,

Thanks for using our products.

Can you please share the source FDF and PDF document so that we can test the scenario at our end. We apologize for your inconvenience.

Hi,

Our data is confidential and we cannot share it with you.

To be on one line, can you please send us the same pdf and fdf files to us and we will test with our code and go further based on the results.

Can you please reply us soon.

To add more, we are able to concatenate the PDF's using the DLL either in the debug as well as in the release mode.

Thanks,

Deepika.

Hello Deepika,

Thanks for your sharing the details.

I have tested the scenario using attached PDF and FDF file and as per my observations, the data is imported into PDF form but the resultant PDF seems to be corrupted. For the sake of correction, I have logged it as PDFNEWNET-29710 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

I am still unable to notice the exception that you are getting. Can you please try using the attached PDF and FDF file and share your results.

Hi,

To my surprise, even after import the fdf to the pdf, PDF is being opened but I was just able to see only empty pdf form (same as student.pdf) with out any data in it.
Following is the code we used. Please let us know if need to make any update for this.

string imageTypeCD = null;
byte[] pdfImage = null, fdf_pdf = null, w2PDF = null;
int pagecount = 0;

FileStream inputStream = new FileStream("D:\\Test HEWI Aspose\\student1.pdf", FileMode.Open);
FileStream fdfStream = new FileStream("D:\\Test HEWI Aspose\\student1.fdf", FileMode.Open);
FileStream outputStream = new FileStream("D:\\Test HEWI Aspose\\result.pdf", FileMode.Create);
try
{
License asposeLicense = new License();
asposeLicense.SetLicense(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["AsposeLicenseFile"]));
Form pdfForm = new Form(inputStream, outputStream);

pdfForm.ImportFdf(fdfStream);

pdfForm.Save();

outputStream.Seek(0, SeekOrigin.Begin);

}
catch (Exception ex)
{
throw;
}
finally
{
inputStream.Close();
inputStream.Dispose();
outputStream.Close();
outputStream.Dispose();
}

Hello Rafael,

I have tested the scenario while using the source PDF and FDF file with Aspose.Pdf for .NET 6.0.0 and as per my observations, the data is properly being updated in the PDF document. Please take a look over the attached resultant PDF that I have generated. In source PDF document, Female check box is selected against Gender field whereas in resultant PDF document, Male check box option is selected. Other fields values are also updated.

[C#]

//open document
Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(“d:/pdftest/student.pdf”, “d:/pdftest/Updated_Student.pdf”);
//open fdf file.
System.IO.FileStream fdfInputStream = new FileStream(“d:/pdftest/student.fdf”, FileMode.Open);
//import data
form.ImportFdf(fdfInputStream);
//close file stream
fdfInputStream.Close();
//save updated document
form.Save();

Yes,

I got the same resulting pdf. But we observe that in both our results the columns Name, Telephone, Address are not visible int he output pdf. Is that the data not given in the fdf, or are they not being updated.

In the previous post you have informed that the dpf generated is corrupted. Can you please give details when the pdf is being corrupted at your side.

Hello Rafael,

In my previous post, I have mentioned that the resultant PDF is corrupt because all the contents of FDF file are not being imported into source PDF form. The FDF file contains information for Name, Address and Telephone field but the respective information is not being imported into Student.pdf document. Sorry for the confusion over this matter. Our development team is working hard to get this issue fixed ASAP and once we have some definite news regarding its resolution, we would be more than happy to update you with the status of correction. We apologize for your inconvenience.

The issues you have found earlier (filed as 29710) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.