wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.33k stars 515 forks source link

wx.lib.pdfwin.PDFWindow couldnot loadfile that contain chiness characters??? #576

Closed jekoie closed 7 years ago

jekoie commented 7 years ago
   def __init__(self, **kwargs):
      self.pdf = PDFWindow(self.panel)

    def OnOpen(self, evt):
        file_dlg = wx.FileDialog(self, u'打开文件', wildcard="pdf file|*.pdf", style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST|wx.FD_CHANGE_DIR)

        if file_dlg.ShowModal() == wx.ID_OK:
            print file_dlg.GetPath(), [file_dlg.GetPath()]
            wx.BeginBusyCursor()
            self.pdf.LoadFile(file_dlg.GetPath() )
            wx.EndBusyCursor()
        file_dlg.Destroy()

filepath: E:\book\精通Python设计模式 高清晰PDF.pdf [u'E:\book\\u7cbe\u901aPython\u8bbe\u8ba1\u6a21\u5f0f \u9ad8\u6e05\u6670PDF.pdf']

The PDFWindow could not load the pdf file that path is unicode???

JorjMcKie commented 7 years ago

which PDF software have you installed? If it is PyMuPDF: I just confirmed that it does work with e.g. Python 3.6 64bit, wxPython 4.0.0rc1 (msw (phoenix)) using the demo software.

jekoie commented 7 years ago

i installed Adobe Reader Xl and run on python2.7, wxpython4.0.0b1 msw(phonenix); the PDFWindow can't load the pdf file when the filename contains chiness characters; but if the filename compose by ascii chars, it works well.

JorjMcKie commented 7 years ago

we are not talking about the same thing: wx.lib.pdfviewer works either with PyMuPDF or PyPDF2. One of the two is required to display PDF files under wxPython. Adobe is not - it plays no role here. wx.lib.pdfviewer first tries to load PyMuPDF, then PyPDF2. If this works for you in some cases, then you must at least have PyPDF2, right?

jekoie commented 7 years ago

i use wx.lib.pdfviewer and install pymupdf, it work pretty well. ^-^

jekoie commented 7 years ago

我对你非常感谢,哈哈; thanks very much.