Export PDF to Excel Spreadsheet Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ShubhamM
Posts: 38
Joined: 08 Nov 2017, 21:38

Export PDF to Excel Spreadsheet

Post by ShubhamM » 13 Apr 2022, 18:07

Hi,

I'm trying to convert a PDF into an excel spreadsheet. I do have a paid version of Adobe Acrobat so I can run commands like combining a PDF with COM. However, I do not know how to export the PDF into an excel spreadsheet with COM. I am able to do the conversion/export manually through the menu bar once the PDF is open but I would like to know if this is possible with COM, without visibly opening a PDF.

Code: Select all

PDF_App := ComObjCreate("AcroExch.PDDoc")
PDF_App.Open(A_Desktop "\Test.pdf")
;Insert Conversion/Export Command here
PDF_App.Close()
Thanks a lot for any assistance you can provide!

User avatar
Xeo786
Posts: 760
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: Export PDF to Excel Spreadsheet  Topic is solved

Post by Xeo786 » 14 Apr 2022, 00:42

Long ago I made this function that convert pdf to xlsx and it still in use

Code: Select all

pdf := "A_Desktop "\Test.pdf"
xlsx := strreplace(pdf,".pdf",".xlsx")
CovertpdftoXlsx(pdf ,xlsx )
msgbox done
return

CovertpdftoXlsx(Inputfile,Outputfile)
{
	; Coverts PDF to Xlsx
	objAcroApp := ComObjCreate("AcroExch.App")
	objAcroAVDoc := ComObjCreate("AcroExch.AVDoc")
	objAcroAVDoc.Open(Inputfile, "")
	objAcroPDDoc := objAcroAVDoc.GetPDDoc
	objJSO := objAcroPDDoc.GetJSObject
	ExportFormat := "com.adobe.acrobat.xlsx"
	objJSO.SaveAs(Outputfile, ExportFormat)
	objAcroAVDoc.Close(1)
	objAcroApp.Exit
}
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory

ShubhamM
Posts: 38
Joined: 08 Nov 2017, 21:38

Re: Export PDF to Excel Spreadsheet

Post by ShubhamM » 14 Apr 2022, 09:44

Awesome! Thanks so much and I think yours works but I actually just found this solution to this last night, searching Adobe Acrobat Javascript:

Code: Select all

PDF_Doc := ComObjCreate("AcroExch.PDDoc")
PDF_Doc.Open(A_Desktop "\test.pdf")
JSO := PDF_Doc.GetJSObject
JSO.SaveAs(A_Desktop "\test.xlsx", "com.adobe.acrobat.xlsx")
PDF_Doc.Close()
Have a fantastic day!

Post Reply

Return to “Ask for Help (v1)”