PdfFileEditor.Append creating corrupt files

Hi,

I recently downloaded the latest version of PDF kit because of another problem with printing and resolution. This seemed to improve the print quality.

However I now notice the output is no longer usable. Adobe Reader indicates the file is corrupt.

I've attached 3 files:

- report.pdf (An A3 document where word documents are appended)

- document.pdf (Word documents already converted to PDF)

- result.pdf Result of the Append. This file is corrupt.

I'm using the following code to combine the file and when I revert to the older version (3.8.0.1) this problem seems to be resolved

private byte[] CombineFiles(byte[] source1, byte[] source2)
{
Aspose.Pdf.Kit.License lic = new Aspose.Pdf.Kit.License();
lic.SetLicense("Aspose.Total.lic");

Aspose.Pdf.License lic2 = new Aspose.Pdf.License();
lic2.SetLicense("Aspose.Total.lic");

// now, a number of PDF's should be combined to one PDF
Aspose.Pdf.Kit.PdfFileEditor edit = new Aspose.Pdf.Kit.PdfFileEditor();

int pages = 0;

if (source1 != null)
{
byte[] tmpBuffer = new byte[source1.Length + source2.Length];

MemoryStream msSource1 = new MemoryStream(source1, 0, source1.Length);
MemoryStream msSource2 = new MemoryStream(source2, 0, source2.Length);
// be sure to set 'publicVisible' to TRUE for the memoryStream!!! otherwise
// using PdfFileEditor.Append will FAIL
MemoryStream msResult = new MemoryStream(tmpBuffer, 0, tmpBuffer.Length, true, true);

// grab number of pages to append to the source1 document (thus: the number of pages of source2)
Aspose.Pdf.Kit.PdfFileInfo fileInfo = new Aspose.Pdf.Kit.PdfFileInfo(msSource2);
pages += fileInfo.NumberofPages;
fileInfo = null;

// append both and return result
edit.Append(msSource1, msSource2, 0, pages, msResult);

msResult.Close();
msSource1.Close();
msSource2.Close();

return tmpBuffer;
}

return source2;
}

Hi,

Sorry for replying you late.

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFKITNET-20843. We will investigate this issue in details and will keep you updated on the status of a correction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.