Print PDF Document with selected layers on in PDFViewWPF viewer.

I have a one page PDF document with about 160+ layers. I turn some of the layers on to represent something in the PDFViewWPF viewer, and now I want to print the document with the layers that are on printed.

I tried the print sample, but all it gave me was a blank page, no layers printed.

Thanks in advance for any help provided.


Sample code only deals with pages, how do I print the current page in the PDFViewWPF viewer with the layers that have been turned on to show up on the print job? Is there a setting for the layers on printing like there is for viewing – Context.SetState(Layer, true/false)?

Thanks for the feedback John.

Our next official release will now support this. In particular,

Print.StartPrintJob will now accept an OCG.Context object. You can either get this explicitly from a PDFViewCtrl or PDFViewWPF object by calling GetOCGContext(). For example

```Print.StartPrintJob(pdfdoc, ``""``, pdfdoc.GetFileName(), ``""``, pagesToPrint, printerMode, viewer.GetOCGContext());

Or you can programmatically modify the documents OCG outside of any viewer. For example

OCG.Context context = new OCG.Context(doc.GetOCGConfig());
// modify context, see for more

, pagesToPrint, printerMode, context);