0

this is the first time I am trying this,

I have a PDF file which is basically a 2D Engineering drawing eg: as given hereDummy image downloaded from net

All drawings are very similar in nature,

I need to find out the centre circular drawings area covered by black ink. I want to find out in the central circular image, what portion of the area is having black ink, and what portion has white dots.

My problem starts with loading the pdf file in python for which I used this code:

import os
os.chdir("E:\WorkStation Laptop\Projects\Shirwal\Printing\PDF Images")

from pdf2image import convert_from_path 

images = convert_from_path('06561  ALKEM LABORATORIES LIMITED mm.pdf') 

for img in images: 
    img.save('output.jpg', 'JPEG')

But this isn't working and giving me this error

PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?

My 2nd step is to extract that area having a circular image and then calculating the black dots area and white dots area

How should I do it?

Kraay89
  • 919
  • 1
  • 7
  • 19
  • as the message says: you don't have Poppler installed. See [How to install](https://pypi.org/project/pdf2image/) – Stef Dec 21 '20 at 12:39
  • When trying to install poppler i am getting this error in anaconda prompt EnvironmentNotWritableError: The current user does not have write permissions to the target environment. environment location: C:\ProgramData\Anaconda3 – Aftab Udaipurwala Dec 21 '20 at 12:43
  • in this case you'll have to install Poppler not globally but per user, see https://stackoverflow.com/questions/51005148/conda-equivalent-of-pip-install-user, or just follow the instructions for Windows in the link I gave above. – Stef Dec 21 '20 at 12:49
  • When trying to do this i am getting this error !pip install --user poppler Collecting poppler ERROR: Could not find a version that satisfies the requirement poppler (from versions: none) ERROR: No matching distribution found for popple – Aftab Udaipurwala Dec 22 '20 at 07:26
  • were did you read to install it using pip? The stackoverflow link I gave explains how to locally install it with conda (using a virtual environment or `-p`. Or just use the binaries from https://github.com/oschwartz10612/poppler-windows/releases/ as recommended in the _How to install_ section of the project page, see my first comment. – Stef Dec 22 '20 at 07:36

0 Answers0