Suppose that we declared the line below in our program :
List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
so we want to print each member of this list into a file and in the separate page, but all in one document like MyDoc.xps. How can i do to achieve my end ?
EDIT : My difficulty is that how can i create new page in printing process?
Sorry if it duplicates with other questions, i can’t get my answer in site threads. 😐
One way that works is the following:
PrintDocumentclass underSystem.Drawing.Printingand use itsPrintPageevent to set the pages one by one.Sample code:
On every page printed, the
document_PrintPagemethod will be called. As long as you won’t sete.HasMorePagesto false, it will keep printing new pages.Edit: to force creating
.xpsfile just add those two lines when creating the print document: