color:#1F497D">We have a licensed Aspose.Pdf ver 9.6 and I am trying to
evaluate if we need to purchase the current version 10.7 to have any better
performance gain converting PDF to XPS and vice versa. Both version has
about the same performance. For a 1.5 mb PDF file with very little
images, it takes about 35~ sec converted to XPS. However, it takes
forever long 15mins still not completed to reverse it back to pdf format.
Do you have any idea if I make any coding mistake here? Below is my sample code.
string asposeTime;
string nixpsTime;
string filename = System.IO.Path.GetFileNameWithoutExtension(pdfFilepath);
string dir = System.IO.Path.GetDirectoryName(pdfFilepath);
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(pdfFilepath);
// Instantiate XPS Save options
Aspose.Pdf.XpsSaveOptions saveOptions = new Aspose.Pdf.XpsSaveOptions();
// Save the XPS document
string outputpath = string.Format("{0}\\{1}-Aspose.xps", dir, filename);
Stopwatch sw = new Stopwatch();
sw.Restart();
pdfDocument.OptimizeResources();
pdfDocument.Save(outputpath, SaveFormat.Xps);
sw.Stop();
asposeTime = string.Format("Aspose(ms) " + sw.ElapsedMilliseconds.ToString());
using (var stream = File.OpenRead(outputpath))
{
byte[] data = new byte[stream.Length];
stream.Read(data, 0, data.Length);
stream.Close();
using (MemoryStream ms = new MemoryStream(data))
{
Aspose.Pdf.LoadOptions options = new XpsLoadOptions();
//options.LoadFormat = LoadFormat.XPS;
using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(ms, options))
{
string output = string.Format(@"{0}\\{1}.pdf", System.IO.Path.GetDirectoryName(outputpath),
System.IO.Path.GetFileNameWithoutExtension(outputpath));
using (FileStream stream1 = new FileStream(output, FileMode.Create))
{
//doc.OptimizeResources();
doc.Save(stream1, Aspose.Pdf.SaveFormat.Pdf);
}
}
}
}
/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman",serif;}<![endif]–>