Quantity and Component Price shifts locations on different PDFs #1

Open
opened 2020-04-15 22:52:01 -04:00 by dan · 1 comment
Owner

The vertical placement of the printing quantity and component cost shifts depending on how much information is in the Job description and, and component information fields.

The vertical placement of the printing quantity and component cost shifts depending on how much information is in the Job description and, and component information fields.
dan closed this issue 2020-04-15 22:52:46 -04:00
dan reopened this issue 2020-04-15 22:53:05 -04:00
Author
Owner

My initial plan to resolve this is to search for the "Quantity" and "Component Totals" blocks. I can use those blocks to set the vertical postions of the selection boxes and use the existing working y values.

From: https://github.com/pymupdf/PyMuPDF/wiki/How-to-extract-text-from-a-rectangle

Get all words on page in a list of lists. Each word is represented by:
[x0, y0, x1, y1, word, bno, lno, wno]
The first 4 entries are the word's rectangle coordinates, the last 3 are just
technical info (block number, line number, word number).

So, for example

rl1 = page.searchFor("Quantity")  # rect list one

qtyrect.append(rl1[0])
qtyrect.append(SOME KNOWN WORKING Y VALUE
qtyrect.append(rl1[2])
qtyrect.append(SOME KNOWN WORKING Y VALUE

Something like this, should find "quantity" on the page. Then we add all the newly found x values into the qtyrect list along with the y values that we know are currently working.

My initial plan to resolve this is to search for the "Quantity" and "Component Totals" blocks. I can use those blocks to set the vertical postions of the selection boxes and use the existing working y values. From: https://github.com/pymupdf/PyMuPDF/wiki/How-to-extract-text-from-a-rectangle ``` Get all words on page in a list of lists. Each word is represented by: [x0, y0, x1, y1, word, bno, lno, wno] The first 4 entries are the word's rectangle coordinates, the last 3 are just technical info (block number, line number, word number). ``` So, for example ``` rl1 = page.searchFor("Quantity") # rect list one qtyrect.append(rl1[0]) qtyrect.append(SOME KNOWN WORKING Y VALUE qtyrect.append(rl1[2]) qtyrect.append(SOME KNOWN WORKING Y VALUE ``` Something like this, should find "quantity" on the page. Then we add all the newly found x values into the qtyrect list along with the y values that we know are currently working.
dan added the bug label 2020-04-17 01:11:57 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dan/pricetable#1