Copy TOC from PDF into Excel

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Copy TOC from PDF into Excel

Post by Rudi »

Hi,

I have over a hundred articles in PDF format. Each of them have a TOC on the first page. I need to create a reference list of the contents of these articles based on the entries in the TOC of each article. Could someone please assist me in creating a macro in Excel which will loop through the list of PDF files (all in one folder), open the file, copy the TOC (on the first page, or just the whole first page if needed) and paste into a sheet in Excel (each below the other, as I plan to clean up the data and make a list from it for reference).

BTW: I need the full file name of the document also inserted into the paste above the TOC as the name contains the date which I need to link to each entry, so I can sort by date too.

I haven't started or provided any source code as I am not familiar with coding between Word and PDF.
Many TX for any assistance on this. The code will greatly help to produce this reference list....
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78660
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Copy TOC from PDF into Excel

Post by HansV »

A PDF document is not the same as a Word document. I don't think it will be easy (if it is possible at all) to extract the table of contents.
If the PDF documents have been created from Word documents, you should get hold of the Word documents.
Otherwise, I don't see how to do what you want.
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Copy TOC from PDF into Excel

Post by Rudi »

Geez....pity...
Its my own docs...but I use a docx and after each month I save it as a PDF before publishing. Then I overwrite the docx with new data for the next month and then save as PDF again... so I don't have the docx anymore...

Anyways...not a train smash. Its a personal project. When I have time I'll just systematically open, copy and paste the data from the pdf.

TX for you valued advice...
Cheers
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78660
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Copy TOC from PDF into Excel

Post by HansV »

If you want to be able to do this in the future, you should keep a copy of each month's Word document.
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Copy TOC from PDF into Excel

Post by Rudi »

I agree.
However, this is a once off spur of the moment idea. I am just interested in pulling some starts from my articles....
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Copy TOC from PDF into Excel

Post by Rudi »

Hans,

I have located a freeware program that will convert my PDFs to TXT. If I have a folder with TXT files, can you work with that to import into Excel as above?
Let me know...TX

Included is a sample of one file... (I am just interested to get the TOC data (maybe via search for Table of Contents) and the file name into Excel (all files appended below each other on one page in excel...I will do scrubbing after that!)
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78660
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Copy TOC from PDF into Excel

Post by HansV »

I'd just copy the TOCS by hand...
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Copy TOC from PDF into Excel

Post by Rudi »

OK...can do.
Cheers :)
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.