Free Support Forum - aspose.com

PdfFileEditor's Concatenate Method Does Not Work

If I create two or more pdf documents and saving them into memory streams using code like this:

int index = 0;

MemoryStream[] pdfStreams = new MemoryStream[psc.Count];

for ( index = 0; index < psc.Count; index++ ) {

pdfStreams[index] = new MemoryStream();

Aspose.Pdf.Kit.Form f = new Aspose.Pdf.Kit.Form(templateFilename,pdfStreams[index]);

f.FillField( "LHeading", psc[index].Heading );

f.Save();

}// for

And then use concatenate like this:

MemoryStream outputStream = new MemoryStream();

Aspose.Pdf.Kit.PdfFileEditor pdfFileEditor = new Aspose.Pdf.Kit.PdfFileEditor();

pdfFileEditor.Concatenate(pdfStreams,outputStream);

The resulting stream (outputStream) contains the first pdf multiple times. The concatenate always copies the first pdf document for each of the following documents. This behaviour is observed in all concatenate method overloads.

Can you please fix this? We need this functionality.

Thanks for considering Aspose.

Please provide at least two pdf documents for us testing. We will try to find out possible reasons that may bring out this inexplicable problem.

You can attach those pdf files or email to kevin.zuo@aspose.com.

Dear Miklovan,
We have fixed this problem and we will release a hotfix soon.

The latest version of Aspose.Pdf.Kit 2.1.0 has been released and your requirements have been implemented. Please refer to http://www.aspose.com/Community/blogs/tommy.wang/archive/2006/06/13/50318.aspx

Best regards.

I still cannot make this work. The output stream has always a length of 0 now. I need the method that takes a stream array and a stream to work, just as in my example. Can you please make a hotfix ASAP?

regards

Kjetil Kristoffer Solberg

Sorry for this inconvenience, our developers will try to fix it up in a short time.

Dear Kjetil,

We have got this problem fixed now. Please download again from http://www.aspose.com/Downloads/Aspose.Pdf.Kit/2.1.0.0/Default.aspx.

Very sorry for you inconvenience.

After concat now when you click on a textbox the text of the previous page/document is shown in place. When click outside of textbox original text comes back.

Also I still get an empty pdf when concating forms made with open office. This is what we are using now to create forms, and we really need them to work.

regards

Kjetil Kristoffer Solberg

Thanks for considering Aspose.

Could you provide the file made by Open Office? We need to test the case if Aspose.Pdf fully supports this kind of document format, because we are not very familiar with Open Office.

I have sent you an email to kevin.zuo@aspose.com. Please let me know if you need anything else.

regards

Kjetil Kristoffer Solberg.

I have got the pdf file you sent. We will check it over and try to find out reasons shortly.

Thanks for your patience.

I have test the code you post here using the latest version of Aspose.Pdf.Kit and can produce the result file. You can download Aspose.Pdf.Kit and test again , then report the result to us.

Best regards,

Georgie Yuan.

I have downloaded the pdf.kit again and the concat method still returns false. I use the template I gave you. Remember to create two pdf documents as streams in an array, and then use the concat method.

Please try again.

regardes

Kjetil Kristoffer Solberg

Thanks for considering Aspose.

What is the meaning of "returns false" ?

Does it mean you can get the concatenated pdf file which contains wrong results, or you got an zero size of pdf file which can not be opened, or you can not get the concatenated pdf at all because of failures when running codes?

The concat method signature looks like this:

bool Concatenate(System.IO.Stream[] inputStreams, System.IO.Stream outputStream);

When this method fails it also returnes false; I guess in accordance with your own documentation on the method.

regards

Kjetil Kristoffer Solberg

So what is the information of false?

I'm sorry I don't understand your question. Could you elaborate please? What information do you need?

regards

Kjetil Kristoffer Solberg

Dear Solberg,
You can test the problem using the project and dll I attached here, and check if it having problem all the same.
Best regards.
Georgie Yuan

Thank you Yuan. I've compiled and run the project and the concat method fails. The result is a outputStream and file of 0 bytes.

regards

Kjetil Kristoffer Solberg

We have tried lots of tests but still can not reproduce the strange error.

Our testing condition:

OS: Windows 2000 5.00.2195 SP3 and Windows XP 2002 sp2 .NET Framework 1.1

Could you tell me yours?

We really need informations to find out all possible differences which may bring out this problem.