We are using the Visual Studio and C# for the development of our WPF application. We have the problem, that we try to print a User Control to PDF. The User Control can extend over more than one page. How can we perform the pagination ? And secondly, each page of the multi-page PDF should have a fixed header/footer. How can this be accomplished with PDFNet components ?
There are multiple ways to create new PDF content using PDFNet. These are described in the following article:
Since you are programming in .NET, the simplest way to create dynamic PDF content using Xaml2Pdf: (http://www.pdftron.com/pdfnet/samplecode.html#Xaml2Pdf)
The same code can be adopted to serialize other WPF content including custom User Controls to PDF. For an example please see:
Another option is dynamic conversion from HTML (string or file) to PDF via pdftron.PDF.Html2Pdf (http://www.pdftron.com/pdfnet/html/classpdftron_1_1PDF_1_1HTML2PDF.html)
In case you need low-level control you can use ElementBuilder/Writer (https://groups.google.com/d/topic/pdfnet-sdk/bSYgR77JiAw/discussion)
In case you go down WPF to PDF (i.e. Xaml2Pdf route, http://www.pdftron.com/pdfnet/samplecode/Xaml2PdfTestCS.cs), the pagination is controlled using .NET API (such as IDocumentPaginatorSource - http://msdn.microsoft.com/en-us/library/ms522721(v=vs.110).aspx)
Pagination in Xaml2Pdf is implemented via DocumentPaginatorWrapper (http://www.pdftron.com/pdfnet/samplecode/Pdftron.Xaml.Convert.cs) which is derived from DocumentPaginator (http://msdn.microsoft.com/en-us/library/system.windows.documents.documentpaginator.aspx). Alternatively you could derive from FlowDocumentPaginator.
As a starting point to get familiar with WPF DocumentPaginators please take a look at the following resources: