Copy link to clipboard
Copied
Hello scripters,
I converted a scanned pdf to doc and then load in inDesign my problem is the footnotes became superscript numbers.
Is there any way we can convert superscript numbers to footnotes in InDesign?
Thanks,
CharlesD
I'm not sure that I properly understand what you need — it's difficult for me to do this, without seeing your file. I assume that you have inclusions of text in superscript and want to convert every such a text range into a separate footnote.
app.findTextPreferences.position = Position.SUPERSCRIPT;
app.changeTextPreferences.changeTo = "";
arrFN = app.documents[0].findText(true);
for (i=0; i<arrFN.length; i++) {
myFN = arrFN.parentStory.footnotes.add(LocationOptions.BEFORE, arrFN.insertionP
...Copy link to clipboard
Copied
I'm not sure that I properly understand what you need — it's difficult for me to do this, without seeing your file. I assume that you have inclusions of text in superscript and want to convert every such a text range into a separate footnote.
app.findTextPreferences.position = Position.SUPERSCRIPT;
app.changeTextPreferences.changeTo = "";
arrFN = app.documents[0].findText(true);
for (i=0; i<arrFN.length; i++) {
myFN = arrFN.parentStory.footnotes.add(LocationOptions.BEFORE, arrFN.insertionPoints[0]);
myFN.texts[0].insertionPoints[-1].contents = arrFN.contents.substr(1);
}
This is not the final solution, just to show you approach. The original superscript text still sould be removed.
Kasyan
Copy link to clipboard
Copied
Thanks Kasyan.
To show a clearer view, we have this scanned book that we have to recreate in indesign and do some modifications in the text. so we convert the scanned pdf to doc file and then load the doc in indesign. The problem with footnotes is that they became part of the text not as real footnotes. so i have to find all the superscripted digits then remove them and insert footnotes manually. then copy and paste the contents to the footnotes frame. if there are 300 footnotes in 1 file it takes years to accomplish this task.
The script you just wrote works perfectly in CS3 (some errors in CS2), i just have to delete the last line. I got what i needed. But if only we could automatically remove the original superscript digits and place the text range into separate footnotes that would be really really great.
- CharlesD
Copy link to clipboard
Copied
Hi Charles,
Here is a new version of the script, it removes original superscript text and retains footnote references. I forgot to mention yesterday that this script is for CS3; I don't have CS2 any more. And since it uses GREP, you just can't do this in CS2.
myDoc = app.activeDocument;
app.findTextPreferences.position = Position.SUPERSCRIPT;
arrFN = myDoc.findText(true);
for (i=0; i<arrFN.length; i++) {
myFN = arrFN.parentStory.footnotes.add(LocationOptions.BEFORE, arrFN.insertionPoints[0]);
myFN.texts[0].insertionPoints[-1].contents = arrFN.contents.substr(1);
}
app.findGrepPreferences.findWhat = "(?<=~F)(.+)";
app.findGrepPreferences.position = Position.SUPERSCRIPT;
app.changeGrepPreferences.changeTo = "";
myDoc.changeGrep();
Kasyan
Copy link to clipboard
Copied
Hi Kasyan,
It works great! It saved me thousands of working hours.
I just have to delete this line though:
myFN.texts[0].insertionPoints[-1].contents = arrFN.contents.substr(1);
It says its not a function.
Is there a way we can also put the appropriate text in those footnotes? so i don't have to cut and paste them.
- CharlesD
Copy link to clipboard
Copied
The script works for me on CS3 for PC. The line you removed inserts text into footnotes – without it the script will not work as intended.
Copy link to clipboard
Copied
Ok thanks Kasyan, always.
Copy link to clipboard
Copied
Did it work for you or not? Can you switch over to CS3/4? I just can't help you with CS2: it doesn't support GREP and I don't have it installed.
Copy link to clipboard
Copied
I have CS3 i tested it and it worked. The only problem is i have to delete the line i mentioned above. because the error says its not a function. so when i removed it, the script actually worked. it replaces the superscript numbers to real footnotes. i just have to manually cut and paste the contents to footnotes accordingly.
Copy link to clipboard
Copied
Could you send me or post a zipped sample file, so that I could see what's going on? My e-mail is askoldich@yahoo.com
Copy link to clipboard
Copied
sent file to your yahoo mail. thanks.
Copy link to clipboard
Copied
Hi Charles,
The difficulty is that footnotes imported from your doc-file are not formatted in superscript. They partially formatted with 9 points size, partially with 10, so it's difficult to differentiate them from the main text.
I offer you to do the following approach:
1 Create a paragraph style "Fnote" and assign it a different color – e.g. blue (Footnotes-1a.indd)
2 Apply "Fnote" style to footnote text:
Go to find/Change > GREP and select these options
Find What: .+$
Find Format: size 9 pt
Change Format: paragraph style "Fnote"
Click Change All (Footnotes-1b.indd)
3 Run the script
Now you have to manually move footnote references (in blue) to their original positions (in black).
This solution is far from perfect: not all text is converted to footnotes, not all original text is removed. To make it perfect would require a day, two or more of work, but I have no time for this.
Kasyan
myDoc = app.activeDocument;
app.findTextPreferences = app.changeTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = "Fnote";
myTexts = myDoc.findText();
for (i = 0; i < myTexts.length; i++) {
myText = myTexts;
myPars = myText.paragraphs;
for (j = 0; j < myPars.length; j++) {
myPar = myPars
myFN = myPar.parentStory.footnotes.add(LocationOptions.BEFORE, myPar.insertionPoints[0]);
myFN.texts[0].insertionPoints[-1].contents = myPar.contents.substr(0, myPar.contents.length-1);
}
}
app.findTextPreferences = app.changeTextPreferences = null;
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "(?<=~F)(.+)";
app.findGrepPreferences.appliedParagraphStyle = "Fnote";
app.changeGrepPreferences.changeTo = "";
myDoc.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = null;
alert("Done");
P.S. The attachment got stuck in the forum, as usual. I'll send it to you by e-mail.
Copy link to clipboard
Copied
I'll give it a try. Thank you very much for spending time with this one.
Copy link to clipboard
Copied
Thanks man! Works well in CS4!
Copy link to clipboard
Copied
Hi All,
My indesing file is double column with footnote. As per the layout option each column is having the footnote. Now my author wants all footnotes to a single column. Please help me how to do this. I am using indesign CS2
Thanks
Karthik
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more