Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Sat Sep 08, 2018 4:51 pm

How do I draw zones in a pdf file and get those zone coordinates and zone sequences so that I can extract text from those zoned areas and save it to a text file?

DB_007
 
Posts: 36
Joined: Sat Sep 08, 2018 4:45 pm

Mon Sep 10, 2018 10:51 am

Hello,

Thanks for your inquiry and sorry for the late reply as weekend.
I made a demo to achieve your requirement, please check it. If there is any question, welcome to write back.
https://www.e-iceblue.com/downloads/attachment/ZonePdf14922.zip

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Mon Sep 10, 2018 12:37 pm

Hi Lisa,
Thanks for that demo. BTW, do yo mind explaining the code in a bit detail, I'm a newbie so it would be really helpful.

Also, your code does not allow multiple zones and I cannot navigate the pdf(if the pdf contains multiple pages).

DB_007
 
Posts: 36
Joined: Sat Sep 08, 2018 4:45 pm

Tue Sep 11, 2018 12:23 pm

Hello,

I made some adjustments of the demo to meet your requirement better. Please check it on your side, if there is any doubt, welcome to write back.
http://www.e-iceblue.com/downloads/attachment/ExtractTextByRectangle14922.7z

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Wed Sep 12, 2018 2:50 am

Hi Lisa,

Thanks for that updated demo, however there is still a big issue. I cannot resize or re-position the zone once I've made the zone, suppose in case I did not properly zone in one go, I cannot re-zone or re-position or stretch or shrink the zone and I have to zone the area again and the previous incorrect zone does remain when I save as text file.
Also, once I zone in one page and click go to next page the red rectangular zone is also shown in that page automatically with same size zone as in page one.
As an aside, can Spire.PDFViewer be used instead of picture box control and can something like the rectangular shape tool in mspaint be created to zone the pdf pages as it can be resized and re-positioned as well very easily.


Sincerely,
DB_007

DB_007
 
Posts: 36
Joined: Sat Sep 08, 2018 4:45 pm

Wed Sep 12, 2018 11:26 am

Hello,

I have to say that the demo I provided yesterday has a minor issue, we corrected it. Now you can download the correct one from previous link. And below are my answers to your questions:
1) You can add a button using below code to cancel previous rectangle, and then re-zone a rectangle.
Code: Select all
 private void RemoveRect_Click(object sender, EventArgs e)
{
    if (dicLists.Count ==0)
    {
        MessageBox.Show("Please paint a rectangle!");
    }
    else
    {
        dicLists.Remove(dicLists.Keys.ElementAt(dicLists.Count-1));
        this.textBox1.Text = dicLists.Count.ToString();
    }
}

2) To remove the red rectangle when going to the next page, you could add below code to draw the rectangle with transparent color when mouse is in the MouseUp status.
Code: Select all
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
    Graphics g = e.Graphics;
    //draw the rectangle
    if (mouseStatus)
    {
        g.DrawRectangle(new Pen(Color.Red, 1), Rect);
    }
    else
    {
        g.DrawRectangle(new Pen(Color.Transparent, 1), Rect);
    }
}

3) Sorry your requirement can not be achieved in our Spire.PDFViewer. If you have other question, please feel free to write back.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Thu Oct 11, 2018 6:39 am

Hello,

Greetings from E-iceblue.
Did my solution work for you? Any feedback will be greatly appreciated. Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Tue Oct 16, 2018 8:17 am

Hi Lisa,
Yes your solution did help a lot.. :)

DB_007
 
Posts: 36
Joined: Sat Sep 08, 2018 4:45 pm

Tue Oct 16, 2018 8:25 am

Hello,

Glad to hear that! If you encounter any issue related to our products in the future, just feel free to contact us.
Wish you all the best!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Wed Apr 15, 2020 4:54 pm

Hello, I would like to know is it possible to manually zone pdfs using spire.pdf,

I need to know how to draw zones in a pdf file and get those zone coordinates and zone sequences, to add images in this zone.

josetavera
 
Posts: 2
Joined: Wed Apr 15, 2020 4:31 pm

Thu Apr 16, 2020 4:14 am

Hi Jose,

Thanks for your inquiry.
For your requirement, I created a sample demo for you, please check. If there is any question, please provide us with the effect you want to achieve, some screenshots may be very helpful.
http://www.e-iceblue.com/downloads/demo/21250Demo.zip

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Apr 24, 2020 10:14 am

Hi Jose,

Hope you are doing well.
Have you tested my project? Does it meet your needs?
Thanks in advance for your feedback.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Sun Apr 26, 2020 11:05 pm

Hi Lisa,
The link that you posted is no available.

kagul223
 
Posts: 1
Joined: Sun Apr 26, 2020 11:02 pm

Mon Apr 27, 2020 2:08 am

Hello Kagul223,

Thanks for your post.
Yes, We cleaned up the older files. Please download and check the extracting demo from this link. If there is any other question, just feel free to write back.
http://www.e-iceblue.com/downloads/demo ... leDemo.zip

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF