We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Print Duplex and Simplex at one printing job

Hello aspose team.

We need to print generated aspose pdf document at one printing job with some pages printed simplex, some duplex.
How could it be done using aspose pdf?

Hi Victor,


We are sorry for the delayed response. I’m afraid Aspsoe.Pdf doesn’t support the requested feature at the moment, as PDF document sent to printer as whole and settings take effect on it as whole. However, I’ve logged a feature request as PDFNEWNET-35925 in our issue tracking system for the same. We will keep you updated about the issue progress via this forum thread.

Please feel free to contact us for any further assistance.

Best Regards,

Tilal Ahmad Sana -

I too am interested in this feature - have you made any progress on this?

Thank you.

Hi Sherri,


Thanks for your inquiry. I am afraid due to other priority issue it still has not been planned. However we have considered your interest in the feature and will notify you as soon as we made some significant progress towards feature implementation.

We are sorry for the inconvenience.

Best Regards,

Hi Victor,


Thanks for your patience.

We have further investigated the feature of “Printing some pages simplex and some duplex within a print job” requested earlier and during our investigations, we have figured out that there is no possibility to change duplex mode at one printing job. Please take a look on code snippet that uses page ranges to print a document with different types of duplex mode. Therefore you should double check it with printer that supports duplex mode:

[C#]

struct PrintingJobSettings<o:p></o:p>

{

public int ToPage { get; set; }

public int FromPage { get; set; }

public string OutputFile { get; set; }

public System.Drawing.Printing.Duplex Mode { get; set; }

}

public void PrintDocument()

{

int printingJobIndex = 0;

string inPdf = @"c:\35925.pdf";

string output = @"c:\output_dir\";

IList<PrintingJobSettings> printingJobs = new List<PrintingJobSettings>();

PrintingJobSettings printingJob1 = new PrintingJobSettings();

printingJob1.FromPage = 1;

printingJob1.ToPage = 3;

printingJob1.OutputFile = output + "35925_1_3.xps";

printingJob1.Mode = Duplex.Default;

printingJobs.Add(printingJob1);

PrintingJobSettings printingJob2 = new PrintingJobSettings();

printingJob2.FromPage = 4;

printingJob2.ToPage = 6;

printingJob2.OutputFile = output + "35925_4_6.xps";

printingJob2.Mode = Duplex.Simplex;

printingJobs.Add(printingJob2);

PrintingJobSettings printingJob3 = new PrintingJobSettings();

printingJob3.FromPage = 7;

printingJob3.ToPage = 7;

printingJob3.OutputFile = output + "35925_7.xps";

printingJob3.Mode = Duplex.Default;

printingJobs.Add(printingJob3);

PdfViewer viewer = new PdfViewer();

viewer.BindPdf(inPdf);

viewer.AutoResize = true;

viewer.AutoRotate = true;

viewer.PrintPageDialog = false;

PrinterSettings ps = new PrinterSettings();

PageSettings pgs = new PageSettings();

ps.PrinterName = "Microsoft XPS Document Writer";

ps.PrintFileName = Path.GetFullPath(printingJobs[printingJobIndex].OutputFile);

ps.PrintToFile = true;

ps.FromPage = printingJobs[printingJobIndex].FromPage;

ps.ToPage = printingJobs[printingJobIndex].ToPage;

ps.Duplex = printingJobs[printingJobIndex].Mode;

ps.PrintRange = PrintRange.SomePages;

pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

ps.DefaultPageSettings.PaperSize = pgs.PaperSize;

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

viewer.EndPrint += (sender, args) =>

{

if (++printingJobIndex < printingJobs.Count)

{

ps.PrintFileName = Path.GetFullPath(printingJobs[printingJobIndex].OutputFile);

ps.FromPage = printingJobs[printingJobIndex].FromPage;

ps.ToPage = printingJobs[printingJobIndex].ToPage;

ps.Duplex = printingJobs[printingJobIndex].Mode;

viewer.PrintDocumentWithSettings(pgs, ps);

}

};

viewer.PrintDocumentWithSettings(pgs, ps);

}