- Code: Select all
string dest = pdf.Replace(".pdf", ".xps");
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(pdf);
doc.SaveToFile(dest, FileFormat.XPS);
Runs out of memory with large PDF files, I generate a PDF that is a collection of PDF's, the PDF that i tested with has 1580 pages, the maximum size of the pdf will be around 1,600 pages for the small batches and for the large batches could have up to 2100 pages per PDF, i need to speed up the print job, but in order to do that, i need to convert the document to XPS format and add it to the printers print queue, and unfortunately the doc.Print() method doesn't just add it to the queue, it does a similar action to just print. This is causing delays in the printing process on large documents. I also need a progress meter during the "savetofile" method, something async, so that i can let the user know something is happening, other than a simple delay when you can't tell anything is happening.
Edit: just updated my program to have a max of 400 pages and the XPS process runs out of memory still, going to keep reducing the max pages to see how low it needs to be for the XPS save to work.
Edit: after a lot of adjustments, the highest number of pages allowed by Spire.PDF for save to XSP is around 160, give or take, depending on if you have images or not, that is 160 pages with just 1 small barcode image, but if you have a lot of images, you have to reduce the number of pages or it won't save to an XPS, plus it alters the image, it stretches/skews and moves the image when you save from a PDF format to an XPS format.