Print PDF Document with selected layers on in PDFViewWPF viewer.

67 views
Skip to first unread message

John Ritchie

unread,
Jul 31, 2014, 12:49:56 PM7/31/14
to pdfne...@googlegroups.com
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.

Cheers,
J.Ritchie

John Ritchie

unread,
Aug 1, 2014, 1:26:06 PM8/1/14
to pdfne...@googlegroups.com
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)?

Ryan - PDFNet Developer

unread,
Aug 8, 2014, 7:45:40 PM8/8/14
to pdfne...@googlegroups.com
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 http://www.pdftron.com/pdfnet/samplecode/PDFLayersTest.cs.html for more
, pagesToPrint, printerMode, context);


Reply all
Reply to author
Forward
0 new messages