tfrost is right I am working
with PDF created by various draftsman in AutoCAD. I checked with
FoxitPhantom and PDF has line as a separate object with x,y + width, height
parameters.
here are sample files https://www.dropbox.com/sh/7ywhw6fysswbaa7/AADQLIRWMeUYRCRhByQgMGtza?dl=0" rel="nofollow - https://www.dropbox.com/sh/7ywhw6fysswbaa7/AADQLIRWMeUYRCRhByQgMGtza?dl=0
tfrost are you able to provide reference
to a function in QuickPDF or sample code, which I need to look for implementing
“…bitmap walk through …. Pixel color” approach.
Also, I do realise that it
is not a straight forward problem, but trust if solved can of great benefit to
wide QuickPDF community.
Let me explain full problem
in details based on sample PDF files at the above link.
1) a) 1003.pdf
and 1004.pdf files are original files provided by a draftsman (normally, full set of pdf files may have 20-100
files similar to 1003 & 1004)
2) b) All files have same layout title block which is
located in this example at the bottom right corner of each page (other
draftsman may use different layout an positon
of the title block)
Task:
Read all supplied PDFs and extract e.g. “DRAWING TITLE”, “DRAWING NUMBER” &
REVISION and etc. Note: in our files “DRAWING TITLE” header is not even provided by a draftsman,
but it can be seen under text “CHARLES STREET”
Proposed
solution: 1) use QuickPDF
to number all text position inside one of the pdf file i.e. “1004.pdf text
blocks.pdf” file and then opens in Adobe Reader for user to review. 2) User will enter 224,227 & 228, which are
correspond to “DRAWING TITLE”, “DRAWING NUMBER” & REVISION
back in to software. Note: 224,227 & 228 at the same time represent (x1,y1) coordinates
of the left bottom part of the text. E.g. 224=(788,572) 3) Software base on
that info runs through rest of the files and extracts values for “DRAWING TITLE”,
“DRAWING NUMBER” & REVISION and etc.
The code for 3 steps works
if all text is left align, but if it is centred then software would not pick up text at expected position due to text moving left and right depending on
number of characters. Implementing something like look in between y1-5mm and
y1+5mm would not work in case there text is to long and close to a text on its left. So y1-5mm may overlap with the text at the left of 224 and give incorrect result.
|