Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Your document is well formatted but it is very big. So I think that you should split you document. Here is code example how you can do that.
Document doc = new Document(@"Test255\200807_PLAT.doc");
//Calculate count of sub documents
//Sub document will have 100 sections (you can generate the smallest documents)
int iterations =0;
if (doc.Sections.Count % 100 > 0)
iterations = (int)(doc.Sections.Count / 100) + 1;
else
iterations = (int)(doc.Sections.Count / 100);
//Generate sub documents
for (int i = 0; i < iterations; i++)
{
Document interDoc = new Document();
interDoc.RemoveAllChildren();
//import sections into the sub document
for (int sectIndex = i * 100; sectIndex < (i + 1) * 100; sectIndex++)
{
if (sectIndex < doc.Sections.Count)
{
Node dstSection = interDoc.ImportNode(doc.Sections[sectIndex], true, ImportFormatMode.KeepSourceFormatting);
interDoc.AppendChild(dstSection);
}
else
{
break;
}
}
//Generate PDF
interDoc.Save(@"Test255\out.xml", SaveFormat.AsposePdf);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(@"Test255\out.xml", null); //Error occurs here
pdf.IsImagesInXmlDeleteNeeded = true;
pdf.Save(@"Test255\out" + i.ToString() + ".pdf");
}
After generating multiple PDF documents you can merge these documents together using Aspose.Pdf.Kit. Here is code example how you can achieve this
string[] pdfNames = Directory.GetFiles(@"Test255", "*.pdf");
Stream[] inStreams = new Stream[pdfNames.Length];
//Create input stream objects holding the PDF files to be concatenated
//Store all input streams in an Array
for (int i = 0; i < inStreams.Length; i++)
{
inStreams[i] = new FileStream(pdfNames[i], FileMode.Open);
}
//Create output stream object that would contain the final PDF file
FileStream outStream = new FileStream(@"Test255\multiStream.pdf", FileMode.Create);
//Instantiate PdfFileEditor object
Aspose.Pdf.Kit.PdfFileEditor pdfEditor = new Aspose.Pdf.Kit.PdfFileEditor();
//Call Concatenate method of PdfFileEditor object to concatenate all input streams
//into a single output stream
pdfEditor.Concatenate(inStreams, outStream);
//Finally close the output stream
outStream.Close();
Hope this helps.
Best regards.