From: Fernando M. L. <ma...@ma...> - 2010-07-16 07:58:10
|
Hi, I'm using PdfEdit version 0.4.2 on Linux and modified a script found in the documentation as a test: //--------- file: haz.qs function my_saveAsText_save(f) { var of=new File(f); of.open(File.WriteOnly); pages=document.getPageCount(); for (i=1;i<=pages;i++) { PageSpace.nextPage(); pg=document.getPage(i); text=pg.getText(); of.write(text); of.write("\n"); } of.close(); } function my_openfile(a,s) { openFile(a); my_saveAsText_save(s); print(tr("Text saved %1").arg(s)); // closeAll(); exit(1); } my_openfile('pad_fams_10_001.pdf', '10-001.txt'); exit(1); //------------ And I run it as $ pdefedit -run haz.qs I need to do that on more than 3000 documents and, as noted in a previous message to this list by Michael Klimczak, if you use closeAll(), the program window closes but the program continues running and you have to kill it. exit(1) does not terminate it either, and I cannot process more than about 15 or 20 documents without running out of memory. By the way, the documents have 11 columns and without the PageSpace.nextPage() call in the loop, only the first page of saved text has the 11 columns, and all the rest pages have 6. Finally, even as this kind of work is not the main purposse of PdfEdit, it is the best application I have found so far to this kind of task, kudos. |