PdfFileEditor: "Input string was not in a correct format"


I’m trying to concatenate two pdf stream (from different component). I used version 1.1 and it worked ok (altough i didn’t know how to concatenate more than two pdf streams).

Now i upgraded to the 1.3 and the program says:
“Input string was not in a correct format”

The code is here:
editor.Concatenate(new MemoryStream(System.Text.ASCIIEncoding.Default.GetBytes(_data[0].ToString())), new MemoryStream(System.Text.ASCIIEncoding.Default.GetBytes(_data[1].ToString())), stream);

I have tried to change to encoding to UTF-8 but no help.

_data[0…n] is coming from SharpPlot.


Dear eksek,

Thanks for considering the kit.

Firstly to check whether the MemoryStream is valid, you can try to write the MemoryStream to a physical Pdf file, then call the concatenate function to merge these files.

If the same exception message is showed again, would you please attach a snippet of your code(including the saved Pdf files), I want to reproduce the error.

Best regards.


MemoryStream is very propably valid, because when i output a single stream directly to the browser, it’s ok. Also when using the 1.1 version of the aspose pdf kit, everything works. I’m trying to avoid saving any files and use streams directly… But if i can’t get it work tomorrow, i’ll do some debug work.

I though it could be something with the string manipulation / encoding differences between 1.1 and 1.3? I haven’t tried version 1.2.


Now i saved the pdf file and tried to open it with Pdf Kit, but still the same error.

PdfFileEditor editor = new PdfFileEditor();
editor.Concatenate(“c:/temp/test1.pdf”, “c:/temp/test1.pdf”, “c:/temp/test2.pdf”);

So test1.pdf is the file i have generated and it’s attached to this message. Pdf Kit creates test2.pdf but it’s empty… so it crashes before it really writes anything.


Now i also tried version 1.2 and it works fine. So all i do is to change the component reference to 1.3 and it goes broken. I Also tried other pdf file (not generated by sharp plot) and same problem… so there is propably some bug in the 1.3. Atleast something has been changed since 1.1 and 1.2

I Also tested the following:

System.IO.MemoryStream stream = new System.IO.MemoryStream();
string inFile1 = “c:/temp/test1.pdf”;
string inFile2 = “c:/temp/test1.pdf”;

FileStream inStream1 = new FileStream(inFile1, FileMode.Open, FileAccess.Read);
FileStream inStream2 = new FileStream(inFile2, FileMode.Open, FileAccess.Read);
PdfFileEditor editor = new PdfFileEditor();
editor.Concatenate(inStream1, inStream2, stream);

--> Same problem with 1.3

All i need is concatenation and it works fine with 1.2 (takes array of streams), so when i register this component, does the license work also with older versions?


Dear eksek,

Sorry for bringing you discomfort.

This error is caused by the Culture and Zone setting in the machine, the default setting is (U.S)English, any other setting may introduce the error.

The hotfix can be downloaded here, it makes you avoid changing the culture setting.

Best regards.