Free Support Forum - aspose.com

PDF to XPS

Hi!

I need to convert a PDF to XPS but I don't want to see the printer dialog. Is there any other way to do it?

I'm also concerned about the speed of conversion. I have tried to decode every page to draw them as images and I want to know which is the fastest way to do it, convert to an image or to an XPS.

Thanks in advance!

If you wanna take a look at my test method, here it is:

private void TestPDF()
{
viewer = new PdfViewer();
viewer.OpenPdfFile(@"D:\TestingPDF\test.pdf");
System.Drawing.Printing.PrinterSettings pset = new System.Drawing.Printing.PrinterSettings();
pset.PrinterName = "Microsoft XPS Document Writer";
pset.PrintToFile = true;
pset.PrintFileName = @"D:\TestingPDF\test.xps";
viewer.PrintDocumentWithSettings(pset);
viewer.ClosePdfFile();
}

Hi Maite,

I’m sorry to inform you that currently Aspose.Pdf.Kit only allows you to convert a PDF to XPS using an XPS printer; however, we have already logged a new feature request as PDFKITNET-14137 in our issue tracking system to provide a self-contained PDF to XPS converter in Aspose.Pdf.Kit. You’ll be updated via this forum thread once it is supported in future.

As far as decoding PDF page to image is concerned, Aspose.Pdf.Kit allows you to decode pages at a rate of 2 seconds per page. However, due to the complexity of the structure of the document this might be a little higher. Nevertheless, if you think the conversion time is too high then please share some sample PDF file so we could test it at our end and provide you the resolution.

We’re sorry for the inconvenience.
Regards,

Thanks for the info provided and also for the feature request.

But I would like to know if it's faster printing a PDF to XPS than converting into image and also if is there any way to avoid the "print dialog" or to hide it.

Thanks again

Hi Maite,

Please have a look at the following sample to see how to hide the print dialog:


//create PdfViewer object and bind PDF file

Aspose.Pdf.Kit.PdfViewer pdfViewer = new Aspose.Pdf.Kit.PdfViewer();

pdfViewer.OpenPdfFile(“Invoice_F001408.pdf”);


//set PrinterSettings and PageSettings

System.Drawing.Printing.PrinterSettings printerSetttings = new

System.Drawing.Printing.PrinterSettings();

printerSetttings.Copies = 1;

printerSetttings.PrinterName = “Microsoft XPS Document Writer”;


//set output file name and PrintToFile attribute

printerSetttings.PrintFileName = @“C:\tempfiles\printoutput.xps”;

printerSetttings.PrintToFile = true;


//disable print page dialog

pdfViewer.PrintPageDialog = false;


//pass printer settings object to the method

pdfViewer.PrintDocumentWithSettings(printerSetttings);

pdfViewer.ClosePdfFile();

As far as the comparison between decoding the pages and printing to XPS is concerned, I would like to say that the printing to XPS would be slower as it also involved the printer.

I hope this helps. If you have any further questions, please do let us know.
Regards,

The issues you have found earlier (filed as 14137 ) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.