Please give me an example of using PDFView (or PDFViewCtrl) with
Python. Tkinter or wxPython or PyQT: anything.
I recommend you have a look at the PDFView sample code in C++ at http://www.pdftron.com/pdfnet/samplecode/PDFViewView.cpp. For a quick recap, there are a few things that you need to take care of while programming PDFView using say wxPython:
(1)Use GetBuffer() to retrieve the rendered buffer to display; (2)Use OnSize() to tell PDFView the size of the client region; (3)Use SetRenderBeginProc() and SetRenderFinishProc() to register two callback functions. RenderBeginProc is called in the rendering thread after the page background is drawn and RenderFinishProc is called after the page foreground is drawn. In the callbacks, you can use GetBuffer() to retrieve the buffer and put it on screen. You could also start a timer in RenderBeginProc to implement progressive rendering; (4)Use OnScroll() and other functions properly to address other user interactions.
Although we don’t provide a PDFView sample using wxPython for now, you can check how PDFNet python APIs are used from the PDFDraw example (http://www.pdftron.com/pdfnet/samplecode/PDFDrawTest.py). PDFView APIs can be found in \Lib\PDFNetPython2.py.
Just for a quick test :
v = PDFView()
v.OnSize(0, 0, 64, 64)
doc = PDFDoc(‘test.pdf’)
buf = v.GetBuffer()
w = v.GetBufferWidth()
h = v.GetBufferHeight()
print(buf, w, h)