Q: I have a PDF file that was produced from a CAD program and I what
to extract all the text relating to the some content present in the
PDF. I have successfully done this part by using the Text Extraction
facility. I have loaded all the text into a ListView and have recorded
the Rect (x1,y1,x2,y2) data. What I'm having trouble understanding
and doing is , I want to click on a record within the ListView and
with that information I would like the PDFViewer to highlight that
particular text content and make sure that it is visible on the
screen. I have tried to convert the code I have found for
highlighting but it is in C and I have not been able to convert to VB.
A few more things that I cannot understand is :
2. How do you redraw the current opened document when you have made a
change to what is currently visible in the viewer. Most of your
examples save a PDF at the end of the process. I would like to display
the changes in real time.
3.When I open the attached PDF and I use the Edit Elements where I can
change the text to blue and remove images example. When it saves the
new PDF for some reason the orientation of the document does not match
how it is opened in the viewer. The viewer shows it as Landscape and
the new saved image saves it as portrait and most of the new
information is lost. Also if I only request text to be used then the
newly created PDF is blank.
2. How do you redraw the current opened document when you have
made a change to what is currently visible in the viewer. Most
of your examples save a PDF at the end of the process. I would
like to display the changes in real
You should lock the document, make change to the document, unlock the
document, then call pdfview.Update() or pdfview.UpdateRect(rect) if
you would like to refresh only a subset of a page.
to highlight that particular steel member and make sure that it is visible on the screen.
To implement custom highlighting in PDFView control, it is probably a
better idea (meaning less work) to implement a custom tool (by
deriving your class from PDFView and overriding OnPaint) and to draw
your (transparent) rectangle on top of the PDF page instead of
modifying underlying PDF document. This is illustrated in PDFView C#
sample project - http://www.pdftron.com/pdfnet/samplecode.html#PDFView,
which implements a number of custom tools (including free-hand
drawing, zoom rect, link create tool etc). You can use the same
approach used to implement 'rectangular zoom', to make sure that
given content is visible on the screen.
3.When I open the ...
When it saves the new PDF for some reason the orientation of the
document does not match how it is opened
You probably need to copy they rotation attribute (new_page.SetRotation
(oldpage.GetRoatation())) after completing the copy/editing process.