First of all sorry for my English.
I’m a consultant for one of yours customers in Italy that need to compile a lot of word document width aspose and then join all the document in a single PDF for download.
I tried width tow different solution:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
- generate all the document in aspose word format;
- join all the document with the my join function (the code is at the end of the message) using the xml pdf format;
- print save the pdf with the SaveAsPDF funcition (the code is at the end of the message).
- generate all the document directly in PDF;
- join the document with PDF4NET library.
For the first solution the problem is the width more then tree document the SaveAsPDF don’t work (no exceptions but at the Save method the CPU go at 100% and stay for ever).
For the second solution the problem is in the PDF4NET library that throw an exception when I try to open the PDF document generated by Aspose.
I asked to PDF4NET team an the replay was:
“The problem you encoutered appears because of the PDF file you are using.
The PDF file (created by Aspose component) has several bugs in it. While
Adobe software is more relaxed and fault tolerant to PDF errors, the PDF4NET
library follows strictly the PDF specification. The problem is that several
structures in the PDF file have specified an invalid length, and when the
library reads the structure, it reads invalid data.”
Can you help me?
private XmlDocument JoinDocument(ArrayList docArray)
if (docArray.Count < 1)
throw new Exception ("Array di documenti vuoto");
Document doc1 = (Document)docArray;
MemoryStream stream1 = new MemoryStream();
XmlDocument xmlDoc1 = new XmlDocument();
XmlNodeList xnlInsertAfter= xmlDoc1.GetElementsByTagName("Section");
XmlNode xnInsertAfter = xnlInsertAfter.Item(0);
XmlNode root = xmlDoc1.DocumentElement;
for (int i=1; i< docArray.Count; i++)
Document doc2 = (Document)docArray;
MemoryStream stream2 = new MemoryStream();
XmlDocument xmlDoc2 = new XmlDocument();
XmlNodeList xnl= xmlDoc2.GetElementsByTagName("Section");
XmlNode xn = xnl.Item(0);
XmlElement elem = xmlDoc1.CreateElement("Section");
foreach (XmlAttribute attr in xn.Attributes)
XmlAttribute newAttr= xmlDoc1.CreateAttribute(attr.Name);
private void SaveAsPdf(XmlDocument xmlDoc)
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.IsImagesInXmlDeleteNeeded = true;
MemoryStream pdfStream = new MemoryStream();