# AttributeError: 'Page' object has no attribute 'getPixmap'

**URL:** <https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504>\
**Category:** Python Help\
**Created:** [October 29, 2022, 2:22am UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504 "2022-10-29T02:22:13Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmmarHoweka](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ammarhoweka/32/9343_2.png) [@AmmarHoweka](https://discuss.python.org/u/AmmarHoweka)\
**Post date:** [October 29, 2022, 2:22am UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/1 "2022-10-29T02:22:13Z")

</div>

I was trying to code a pdf reader and I got this Error!!! Any Ideas?

```auto
from tkinter import * 
from tkinter import filedialog
from tkPDFViewer import tkPDFViewer as pdf
import os

the_prog = Tk()
the_prog.title("PDF Viewer")
the_prog.geometry("500x650+550+100")
the_prog.resizable(False, False)
the_prog.configure(background='white')

def open_dir(): #The function used to open the file where I can't find the error!
    the_file = filedialog.askopenfilename(initialdir=os.getcwd(), title ="Choose the PDF File", filetype=(("PDF File",".pdf"),("PDF File","pdf"), 
    ("PDF File", "PDF")))
    
    show_file = pdf.ShowPdf() 
    show_pdf = show_file.pdf_view(the_prog, pdf_location=open(the_file,'r'), width=77,height=100)
    show_pdf.pack(pady=(0,0))

choose_button= Button(the_prog, text = "Choose the pdf File", width = "50", font= ("Arial","15"),fg = "white",bg = "red", cursor = "hand2", command = open_dir)
choose_button.pack()

folder_image = PhotoImage(file="Image1.png")
background_photo = Label(the_prog, image=folder_image, width=300, height=300 )
background_photo.place(x=100, y=150)

under_text = Label(the_prog, text= "Thank you for choosing us.", font= "Arial")
under_text.place(x=160,y=550)
under_text2 = Label(the_prog, text= "®Ammar Howeka", font=('Arial','10'))
under_text2.place(x=380,y=620)

the_prog.mainloop()

```

---

<div class="post-metadata">

**Author:** ![barry-scott](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@barry-scott](https://discuss.python.org/u/barry-scott)\
**Post date:** [October 29, 2022, 7:29am UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/2 "2022-10-29T07:29:58Z")

</div>

You have not included the traceback, without that we can not be sure what is wrong.

---

<div class="post-metadata">

**Author:** ![AmmarHoweka](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ammarhoweka/32/9343_2.png) [@AmmarHoweka](https://discuss.python.org/u/AmmarHoweka)\
**Post date:** [October 29, 2022, 2:57pm UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/3 "2022-10-29T14:57:57Z")

</div>

Here is the traceback:

````auto
Traceback (most recent call last):
  File "C:\Users\Momento\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\Momento\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Momento\AppData\Local\Programs\Python\Python38\lib\site-packages\tkPDFViewer\tkPDFViewer.py", line 46, in add_img
    pix = page.getPixmap()
AttributeError: 'Page' object has no attribute 'getPixmap'```
````

---

<div class="post-metadata">

**Author:** ![barry-scott](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@barry-scott](https://discuss.python.org/u/barry-scott)\
**Post date:** [October 29, 2022, 9:22pm UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/4 "2022-10-29T21:22:09Z")

</div>

I tried to install tkPDFViewer and see that it want to run setup.py.  
I’m not willing to let it do that.

I also see that its not been updated for any release since 3.6 and in Jan 1 2021.

This looks to be an abandon package maybe look for a support one?

---

<div class="post-metadata">

**Author:** ![abdnafees](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/abdnafees/32/9551_2.png) [@abdnafees](https://discuss.python.org/u/abdnafees)\
**Post date:** [October 29, 2022, 10:21pm UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/5 "2022-10-29T22:21:00Z")

</div>

Is there activity on the github repo?

When I face such issues, I just try to look for an alternative if downgrading doesn’t work as well.

---

<div class="post-metadata">

**Author:** ![AmmarHoweka](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ammarhoweka/32/9343_2.png) [@AmmarHoweka](https://discuss.python.org/u/AmmarHoweka)\
**Post date:** [October 29, 2022, 10:32pm UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/6 "2022-10-29T22:32:10Z")

</div>

So we can say that: package issue and there is no any solution?

---

<div class="post-metadata">

**Author:** ![abdnafees](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/abdnafees/32/9551_2.png) [@abdnafees](https://discuss.python.org/u/abdnafees)\
**Post date:** [October 29, 2022, 10:46pm UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/7 "2022-10-29T22:46:06Z")

</div>

For now yes, one solution is to try to fix it yourself but that will require considerable time and effort.

---

<div class="post-metadata">

**Author:** ![ErenAK21](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/erenak21/32/9636_2.png) [@ErenAK21](https://discuss.python.org/u/ErenAK21)\
**Post date:** [November 3, 2022, 1:08pm UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/8 "2022-11-03T13:08:56Z")

</div>

I had the same problem few days ago and i found the solution. I edit the Funktion add\_img because there was a mistake with the ussage of the fitz Libary Here is my code:

```auto
 def add_img():
            precentage_dicide = 0
            open_pdf = fitz.open(pdf_location)

            for page in open_pdf:
                pix = page.get_pixmap()
                pix1 = fitz.Pixmap(pix,0) if pix.alpha else pix
                img = pix1.tobytes("ppm")
                timg = PhotoImage(data = img)
                self.img_object_li.append(timg)
                if bar==True and load=="after":
                    precentage_dicide = precentage_dicide + 1
                    percentage_view = (float(precentage_dicide)/float(len(open_pdf))*float(100))
                    loading['value'] = percentage_view
                    percentage_load.set(f"Please wait!, your pdf is loading {int(math.floor(percentage_view))}%")
            if bar==True and load=="after":
                loading.pack_forget()
                self.display_msg.pack_forget()

            for i in self.img_object_li:
                self.text.image_create(END,image=i)
                self.text.insert(END,"\n\n")
            self.text.configure(state="disabled")

```

---

<div class="post-metadata">

**Author:** ![AmmarHoweka](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ammarhoweka/32/9343_2.png) [@AmmarHoweka](https://discuss.python.org/u/AmmarHoweka)\
**Post date:** [November 5, 2022, 10:26pm UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/9 "2022-11-05T22:26:45Z")

</div>

can you please explain more and write the code including mine as i’ve issue with fitz

---

<div class="post-metadata">

**Author:** ![ErenAK21](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/erenak21/32/9636_2.png) [@ErenAK21](https://discuss.python.org/u/ErenAK21)\
**Post date:** [November 9, 2022, 8:47am UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/10 "2022-11-09T08:47:24Z")

</div>

There is nothing wrong with your Code, the Libary has 2 Issues. Swap the Funktion add\_img in the file C:\Users\Momento\AppData\Local\Programs\Python\Python38\lib\site-packages\tkPDFViewer\tkPDFViewer.py with the Code in my previous post

---

<div class="post-metadata">

**Author:** ![softsilence](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@softsilence](https://discuss.python.org/u/softsilence)\
**Post date:** [November 17, 2022, 3:29pm UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/11 "2022-11-17T15:29:56Z")

</div>

I am having de same issue using tkPDFViewer library. here the error im getting `AppData\Local\Programs\Python\Python310\lib\site-packages\tkPDFViewer\tkPDFViewer.py", line 46, in add_img pix = page.getPixmap() AttributeError: 'Page' object has no attribute 'getPixmap'. Did you mean: 'get_pixmap'?` well, then if i change getPixmap to get\_pixmap I get the following error:

```auto
`AppData\Local\Programs\Python\Python310\lib\site
packages\tkPDFViewer\tkPDFViewer.py", line 48, in 
add_imgimg = pix1.getImageData("ppm")
AttributeError: 'Pixmap' object has no attribute 'getImageData'`

```

A lot of people need some help from tkPDFViewer’s owner. but what I want is, pip community have to delete this tkPDFViewer library, because it has no a preview version, it is the only version the owner release, then if the very first release doesn’t work, it means the owner have not tested his code before pushing it into production. the owner should have specified versions for any change made in the code rather than pushing the code in differing method to bypass pip version controller. and that change of GETPIXMAP should be considered as mayor change of version. here I’m using the library:

```auto
`# Importing tkinter to make gui in python

from tkinter import*

# Importing tkPDFViewer to place pdf file in gui.
# In tkPDFViewer library there is
# an tkPDFViewer module. That I have imported as pdf

from tkPDFViewer import tkPDFViewer as pdf

# Initializing tk

root = Tk()

# Set the width and height of our root window.

root.geometry("550x750")

# creating object of ShowPdf from tkPDFViewer.

v1 = pdf.ShowPdf()

# Adding pdf location and width and height.

v2 = v1.pdf_view(root,pdf_location = r"simplepdf.pdf",width = 
50,height = 100)

# Placing Pdf in my gui.

v2.pack()

root.mainloop()`

```

---

<div class="post-metadata">

**Author:** ![flywire](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/flywire/32/4728_2.png) [@flywire](https://discuss.python.org/u/flywire)\
**Post date:** [August 25, 2023, 11:08am UTC](https://discuss.python.org/t/attributeerror-page-object-has-no-attribute-getpixmap/20504/12 "2023-08-25T11:08:19Z")

</div>

> [@ErenAK21](#):
>
> I edit the Funktion

What is _the Funktion_?
