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.

Thu Mar 25, 2021 6:58 pm

Can I find paths in PDF documents using Spire? My use case is as follows (based on the attached PDF):

1. Locate the string "Width 2"
2. Find the position of any point on the first Path immediately to the "left" of the X,Y of the found string.

steveferda
 
Posts: 4
Joined: Tue Sep 22, 2020 8:52 pm

Fri Mar 26, 2021 2:07 am

Hello,

Thanks for your inquiry.
Please refer to the following code to achieve your requirements. Feel free to contact us if you have further questions.
Code: Select all
            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile(@"Example1.pdf");
            PdfTextFind[] result = null;
            foreach (PdfPageBase page in pdf.Pages)
            {
                //Find text
                result = page.FindText("Width 2", TextFindParameter.None).Finds;
                foreach (PdfTextFind find in result)
                {
                    PointF point=find.Position;
                    float X=point.X;
                    float Y=point.Y;
                }
            }


Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Fri Mar 26, 2021 3:53 pm

This is not quite what I am looking for. I am attempting to find the Path -- the line drawn in red, in this illustration -- which is to the left of the found text.

If Spire has a way to find the position of Paths in PDFs, that would be a place to start.

Thoughts?

steveferda
 
Posts: 4
Joined: Tue Sep 22, 2020 8:52 pm

Mon Mar 29, 2021 6:39 am

Hello,

Thanks for your further clarification.
Sorry to tell you that our Spire.PDF doesn't support the feature you mentioned. If there is anything else we can do for you, please feel free to contact us.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Return to Spire.PDF

cron