Skip to main content
April 23, 2020
Answered

I want to extract and sort data in other PDF files ...

  • April 23, 2020
  • 1 reply
  • 1549 views

Perhaps this is a basic question about an array.  

 

And I'm sorry, this is a question to all that how to write code as an answer.  

I have no experience writing code for arrays. 

 

I have read various descriptions about arrays, but I am not sure how to realize it with PDF in front of me.

 

====

 

I would like to know the following cases.
The First PDF file has fields with the following contents.

 

This is a list of equipment maintenance replacement parts.
Parts to be replaced are lined up at regular intervals.

 

Actually, there are more items both vertically and horizontally, but it is like this when simplified.  There are over 100 pages.

 

From left to right ("Field Name")

Time Unit / Cumulative Time / Implementation Date / Part Name / Selling Price

 

"TU1"     "CT1"     "ID1"     "PN1"     "SP1"
"TU2"     "CT2"     "ID2"     "PN2"     "SP2"
"TU3"     "CT3"     "ID3"     "PN3"     "SP3"
"TU4"     "CT4"     "ID4"     "PN4"     "SP4"
"TU5"     "CT5"     "ID5"     "PN5"     "SP5"
"TU6"     "CT6"     "ID6"     "PN6"     "SP6"
"TU7"     "CT7"     "ID7"     "PN7"     "SP7"
"TU8"     "CT8"     "ID8"     "PN8"     "SP8"
"TU9"     "CT9"     "ID9"     "PN9"     "SP9"
"TU10"   "CT10"   "ID10"   "PN10"    "SP10"
"TU11"   "CT11"   "ID11"    "PN11"    "SP11"

"TU1000"   "CT1000"   "ID1000"    "PN1000"    "SP1000"

 

This field will increase in the future.

 

As the Implementation Date, the date of the result calculated by JavaScript based on the cumulative time is entered.  Actually, there are other fields such as start date.

 

So, the data is arranged as follows.  In short, it is like Excel with a beautifully designed background.  Actually I wanted to make it in Excel, but for several reasons I'm making it directly in PDF.

 

<3000>     <3000>    <day1>  <name1> <price1>
<3000>     <6000>    <day2>  <name1> <price1>
<3000>     <9000>    <day3>  <name1> <price1>
<3000>   <12000>    <day4>  <name1> <price1>
<3000>   <15000>    <day5>  <name1> <price1>
<3000>   <18000>    <day6>  <name1> <price1>
<3000>   <21000>    <day7>  <name1> <price1>
<3000>   <24000>    <day8>  <name1> <price1>
<3000>   <27000>    <day9>  <name1> <price1>
<3000>   <30000>   <day10> <name1> <price1>
<3000>   <33000>   <day11> <name1> <price1>
<3000>   <36000>   <day12> <name1> <price1>

 

<6000>     <6000>   <day2>   <name2> <price2>
<6000>   <12000>   <day4>   <name2> <price2>
<6000>   <18000>   <day6>   <name2> <price2>
<6000>   <24000>   <day8>   <name2> <price2>
<6000>   <30000>   <day10> <name2> <price2>
<6000>   <36000>   <day12> <name2> <price2>

 

<12000>  <12000>  <day4> <name3> <price3>
<12000>  <24000>  <day8> <name3> <price3>
<12000>  <36000>  <day12> <name3> <price3>

 

<36000>  <36000>  <day12> <name4> <price4>

 

I want to extract the data from here to another individual PDF file.  

Specifically, for each cumulative time lined up vertically in the second field from the left.  I think it's probably simple code, but I'm not sure.

 

For example, for another PDF file that exports cumulative <36000> hours of data,

 

<36000> <day12>  //The 36000th hour comes on <Day12>

 

<3000>    <name1>   <price1>  //The parts that must be replaced on that day are:
<6000>    <name2>   <price2>
<12000>  <name3>   <price3>
<36000>  <name4>   <price4>

 

And I would like to fit in the following fields placed in the <36000> hour PDF file

 

"H1"     "D1"

 

"T1"     "N1"     "P1"
"T2"     "N2"     "P2"
"T3"     "N3"     "P3"
"T4"     "N4"     "P4"
"T5"     "N5"     "P5"
"T6"     "N6"     "P6"
"T7"     "N7"     "P7"
"T8"     "N8"     "P8"
"T9"     "N9"     "P9"
"T10"   "N10"   "P10"
"T11"   "N11"    "P11"

 

I don't know how to write this.
I don't even know where to write it.

 

Sorry for the really basic question.
Thanking you in advance.

This topic has been closed for replies.
Correct answer Test Screen Name

I apologize first. I hadn't visited this site for a few days.

Because I gave up on getting the answer at here.

 

I am a Japanese living in China for work.

And I didn't know the page you introduced to me.

 

As you know, foreigners who live in China like us cannot "search" overseas sites from China because of China's internet regulations.  Only Chinese sites can be searched here.

 

I have a contract with a major VPN provider, but in reality it can only be used for sending and receiving Gmail.  I have contracted with 3 VPN companies for a year in the past, but all their advertising were lie.  Because they are always losing the competition with the Chinese government.  In short, I can't always get a VPN connection. When I can't connect to VPN, I can't log in with my Gmail address, so I can't write a comment like this also.  

 

In any case, even if I want to study JavaScript programming for PDF, I am not able to find decent explanations or materials, so I am at a loss.  I don't know why, but I can't find anywhere in Japanese documents about PDF JavaScript.  I don't even know what I can and cannot do with PDF.

 

Anyway thank you for your reply. 
I would like to read all the pages you introduced first.


I answered this early on, and you did not even acknowledge the answer. The more you ask, the more I am convinced this is the right answer. Use Excel instead. Overcome those unspecified reasons you mentioned, and consider functionality more important than a pretty background.

1 reply

Legend
April 23, 2020

A warning: 100 pages? Each with 100 forms? You will have to type in and choose the options for each of the 10,000 form fields. But if you do that, you will have a PDF with far too many fields. This will collapse and be unusable after all that work. PDF is not a spreadsheet. I recommend you go back to Excel. PDF is great for a frozen view (uneditable, unchangable) of a spreadsheet at one moment.

April 23, 2020

How many fields can I use?

If I know it, split the original PDF.

Currently, about 2700 fields are actually used.

Thom Parker
Community Expert
Community Expert
April 27, 2020

Don't get me wrong.
And if you are offended, please forgive me.

 

Your advice was very helpful to me.
I am grateful.

 

I am going to make a fix according to youe advice.
Specifically, the original file may be divided for each model.

 

But I also want to know it for future study.
Please understand it.  m(_ _)m


To solve your first problem you will need to write an automation script. This is something I do quite a lot. To know the feasibility and difficulty of the specific task you want, will require you to write a simple and concise explanation. But it seems this should be possible, but require a not-small amount of work. You can read about this type of scripting here:

https://www.pdfscripting.com/public/Automating-Acrobat.cfm

https://www.pdfscripting.com/public/Form-Data-Handling.cfm

 

If you are not up to this task, I would suggest hiring a consultant.  I would be happy to help you with this task.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often