Renaming a pdf when it is opening
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
-
- User
- Posts: 74
- Joined: Fri Jun 03, 2016 5:49 am
Renaming a pdf when it is opening
I have produced a large number of scanned pdf documents which were randomly named. So I need to rename it but everytime I had to close the document before ren . Can I rename a pdf when it is still opening?
-
- User
- Posts: 2394
- Joined: Wed Jan 18, 2006 12:10 pm
Re: Renaming a pdf when it is opening
Rename your PDFs via Windows File Explorer:
1) Activate the Preview pane
- In Windows 10, in File Explorer, in the View ribbon, activate "Preview pane"
or
- In Windows 7, in File Explorer, click the Organize button, Layout, activate "Preview pane"
2) Click on one of your PDFs
Normally the content should be showing up in the Preview pane (thanks to the Shell Extensions of PDF-XChange).
By moving the left border of the preview pane, you can enlarge or reduce the preview.
3) To rename the PDF, just click once again on its name to make it editable.
1) Activate the Preview pane
- In Windows 10, in File Explorer, in the View ribbon, activate "Preview pane"
or
- In Windows 7, in File Explorer, click the Organize button, Layout, activate "Preview pane"
2) Click on one of your PDFs
Normally the content should be showing up in the Preview pane (thanks to the Shell Extensions of PDF-XChange).
By moving the left border of the preview pane, you can enlarge or reduce the preview.
3) To rename the PDF, just click once again on its name to make it editable.
Re: Renaming a pdf when it is opening
Another way is to use Save As. That'll make a separate file so the old one will still be available until you delete it and also the file now on the tab is the newly named one.
Re: Renaming a pdf when it is opening
Yes please. +2 for this feature request.kongyiu9998 wrote:I have produced a large number of scanned pdf documents which were randomly named. So I need to rename it but everytime I had to close the document before rename. Can I rename a pdf when it is still open?
PDF-XChange Editor would be the first Windows application in the world that allows the incredibly useful renaming of open files. Another one of many "world's first" of PDF-XChange Editor.
"Just dreaming of that upcoming killer feature"
click to try
I probably would use this every day.
Technically spoken, of course it is not possible to rename a file that is actually open. However, this feature would still be perfectly doable, as already discussed at length and in all detail starting from here, and solved up to the state of pseudocode here.
Cheers
David.P
Last edited by David.P on Tue Sep 26, 2017 7:54 am, edited 1 time in total.
David.P
PDF-XChange Pro
PDF-XChange Pro
Re: Renaming a pdf when it is opening
"PDF-XChange Editor would be the first Windows application in the world that allows the incredibly useful renaming of open files. Another one of many "world's first" of PDF-XChange Editor."
In Notepad++ it's possible to rename a file name while it is open.It is also possible to switch to Windows explorer and rename the file while it is still open in Notepad++
In that case - when switching back to Notepad++ - one will get a message that says that the file doesn't exist anymore and if you wish to keep it in the Editor.
HaPe
In Notepad++ it's possible to rename a file name while it is open.It is also possible to switch to Windows explorer and rename the file while it is still open in Notepad++
In that case - when switching back to Notepad++ - one will get a message that says that the file doesn't exist anymore and if you wish to keep it in the Editor.
HaPe
-
- User
- Posts: 2394
- Joined: Wed Jan 18, 2006 12:10 pm
Re: Renaming a pdf when it is opening
Possible approaches to (programmatically) rename a PDF:
1) Execute a Save As with a new name and - after a successful save - Delete the original.
Inconvenience of this, is that you will need two times the storage-space of the file... can be a problem on memory sticks.
2) Close the file, Rename the file, re-Open the file with its new name.
3) Work with a temporal copy (on the local hard disk) when a document is opened.
When the document is closed, it can be written (with a new name) to its original folder and the original file can be deleted.
If the name of the PDF has not been changed, then the original file can first be renamed and after a successful save of the new version, it can be deleted.
Inconvenience of this, is that the original file can have been modified in the meanwhile (by someone else).
4) ... other ideas ? ...
1) Execute a Save As with a new name and - after a successful save - Delete the original.
Inconvenience of this, is that you will need two times the storage-space of the file... can be a problem on memory sticks.
2) Close the file, Rename the file, re-Open the file with its new name.
3) Work with a temporal copy (on the local hard disk) when a document is opened.
When the document is closed, it can be written (with a new name) to its original folder and the original file can be deleted.
If the name of the PDF has not been changed, then the original file can first be renamed and after a successful save of the new version, it can be deleted.
Inconvenience of this, is that the original file can have been modified in the meanwhile (by someone else).
4) ... other ideas ? ...
Re: Renaming a pdf when it is opening
Good find, HaPe!
I hadn't seen that option in Notepad++.
There, you can actually even right-click on an open file's tab and directly rename the file from there.
...like I had dreamed up for PDF-XChange Editor:
Notepad++ in this case silently saves the file under the desired new name, and deletes the original file from disk.
This probably would also be the way to go with PDF-XChange Editor. Willy's scenario where there is not enough space on the disk (or stick) to temporarily create a copy of the file probably will amount to like 0,001% of the use cases, and therefore practically never lead to a respective error message.
Regards
David.P
I hadn't seen that option in Notepad++.
There, you can actually even right-click on an open file's tab and directly rename the file from there.
...like I had dreamed up for PDF-XChange Editor:
Notepad++ in this case silently saves the file under the desired new name, and deletes the original file from disk.
This probably would also be the way to go with PDF-XChange Editor. Willy's scenario where there is not enough space on the disk (or stick) to temporarily create a copy of the file probably will amount to like 0,001% of the use cases, and therefore practically never lead to a respective error message.
Regards
David.P
David.P
PDF-XChange Pro
PDF-XChange Pro
- Paul - Tracker Supp
- Site Admin
- Posts: 6900
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: Renaming a pdf when it is opening
Hi guys,
after discussing this with the dev team it has been pointed out to me that notepad++ is text editor and as such a much simpler process to do the temp saving, deleting and renaming that is required. We have in PDFs a much more complex format that requires a little a little more care. While the concept is valid the implementation of it is not trivial.
We have plugins for Sharepoint, Google Drive, and Dropbox that would need to be considered also.
The long and the short of it is that while possible, the complexity of implementation outweighs the perceived benefit from our perspective. As such it is unlikely to see work done on it in the foreseeable future.
after discussing this with the dev team it has been pointed out to me that notepad++ is text editor and as such a much simpler process to do the temp saving, deleting and renaming that is required. We have in PDFs a much more complex format that requires a little a little more care. While the concept is valid the implementation of it is not trivial.
We have plugins for Sharepoint, Google Drive, and Dropbox that would need to be considered also.
The long and the short of it is that while possible, the complexity of implementation outweighs the perceived benefit from our perspective. As such it is unlikely to see work done on it in the foreseeable future.
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Re: Renaming a pdf when it is open
Hello all,
after the same feature request came up again recently, I take the liberty to respectfully disagree with the opinion that renaming a PDF file (from within PDF-XChange Editor) is more complex than renaming a TXT file (from within a text editor).
All that has to be done to rename an "open" file (be it TXT, PDF or whatever) is still only the following:
Best regards
David
--
after the same feature request came up again recently, I take the liberty to respectfully disagree with the opinion that renaming a PDF file (from within PDF-XChange Editor) is more complex than renaming a TXT file (from within a text editor).
All that has to be done to rename an "open" file (be it TXT, PDF or whatever) is still only the following:
- Do a "save as" (under the new name); and
- Delete the previous copy (with the old name) from disk.
Best regards
David
--
David.P
PDF-XChange Pro
PDF-XChange Pro
- Will - Tracker Supp
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
- Contact:
Re: Renaming a pdf when it is opening
Hi David,
It's not quite that simple - We have to consider the possibility that the document may be stored on a network drive and that it may be in use by another user. This makes it much more complex an implementation.
There is quite a lot to take into consideration to avoid serious problems. I personally like the idea of the feature (though not all of my colleagues share that opinion), but I do understand the difficulties in the implementation and the fact that even were we to definitely agree to implement it, it should not be given a priority status as there are more fundamental features and fixes to implement.
For now, this JavaScript (supplied by a user in another topic) can be added to the JavaScripts folder under C:\Program Files\Tracker Software\PDF Editor\JavaScripts: Here's the actual code:
Thanks,
It's not quite that simple - We have to consider the possibility that the document may be stored on a network drive and that it may be in use by another user. This makes it much more complex an implementation.
That's also not quite true, as the first question that we would be asked by many users is "why can we not do this in SharePoint/Google Drive/Dropbox".In case this extremely simple approach indeed should not be applicable to files saved on Sharepoint, Google Drive or Dropbox, the feature simply could be greyed out in these cases.
There is quite a lot to take into consideration to avoid serious problems. I personally like the idea of the feature (though not all of my colleagues share that opinion), but I do understand the difficulties in the implementation and the fact that even were we to definitely agree to implement it, it should not be given a priority status as there are more fundamental features and fixes to implement.
For now, this JavaScript (supplied by a user in another topic) can be added to the JavaScripts folder under C:\Program Files\Tracker Software\PDF Editor\JavaScripts: Here's the actual code:
Code: Select all
app.addToolButton({
cName: "5",
// oIcon: oIcon2,
cExec: "rename_doc();",
cTooltext: "Aktives Dokument umbenennen",
cLabel: " ",
nPos: -1
});
function rename_doc()
{
var box;
var bDelete;
var myDocPath;
if (this.numPages==undefined)
{
app.alert("Kein aktives Dokument!",2);
return;
}
box=app.alert("Aktives Dokument umbenennen?",2,2,"Umbenennen");
if(box==4){
var cFile = app.response("Neuer Name:","Umbenennen"); // should have filename only including extension pdf
// app.response(cQuestion,cTitle,cDefault,bPassword,cLabel);
var strNewPath;
if (cFile==null || cFile=="")
{
app.alert("Abbruch!",2);
return;
}
if (this.documentFileName=="") // not yet saved! No deleting required
{
bDelete=false;
// Acquire path for current document
var oRetn = app.browseForDoc({
cFilenameInit: cFile, // will be ok in the next build .122, at the moment no name is in the getbox
bSave: true,
});
if ( typeof oRetn != "undefined" )
{
strNewPath = oRetn.cPath;
} else return;
} else
{
// has a Name, delete afterwards
bDelete=true;
// Acquire path from current document
myDocPath = this.path;
// break into an array of path components
var aPathComps = myDocPath.split("/");
// var pathRoot = aPathComps[1]; // second element
var myFilename = aPathComps[aPathComps.length-1]; // Last element
// First pop the old file name off the end
aPathComps.pop();
// Next, add the new file name to the end of the array
aPathComps.push(cFile);
// Put the path back together as a string
strNewPath = aPathComps.join("/");
}
// console.println(strNewPath);
var ret=this.saveAs({
cPath: strNewPath,
bPromptToOverwrite: true // if exists ask for overwriting
});
if (bDelete==true)
{
this.closeDoc(); // schliessen
app.alert("Löschen von Hand: " + myDocPath);
// delete myDocPath
}
app.openDoc(strNewPath);
}
else if(box==false){
app.alert("Abbruch!");
}
}
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Re: Renaming a pdf when it is opening
Hello Will, and thank you very much for your answer.
In order to be 100% on the safe side, the feature then simply would be implemented like so: PDF-XChange Editor first actually closes the current PDF document, then renames it, and finally re-opens it under the new name. In case the re-naming is impossible for some reason, the file just would be opened under the old name again with the error message: "File in use, renaming not possible. Please rename or 'save as' manually"
Thank you again,
Regards
David
Understood.Will - Tracker Supp wrote:It's not quite that simple - We have to consider the possibility that the document may be stored on a network drive and that it may be in use by another user. This makes it much more complex an implementation. There is quite a lot to take into consideration to avoid serious problems.
In order to be 100% on the safe side, the feature then simply would be implemented like so: PDF-XChange Editor first actually closes the current PDF document, then renames it, and finally re-opens it under the new name. In case the re-naming is impossible for some reason, the file just would be opened under the old name again with the error message: "File in use, renaming not possible. Please rename or 'save as' manually"
That's understood completely, Will. This feature is definitely a 'luxury plus' feature, since it is available in no other Windows software either (other than Notepad++, as we have learned from HaPe). OTOH that's also the reason why it just would be such a killer feature once againWill - Tracker Supp wrote:the fact that even were we to definitely agree to implement it, it should not be given a priority status as there are more fundamental features and fixes to implement.
Thanks for the code! I tried it and I find it amazing that this is possible in PDF-XChange Editor. If I get around to it I may ask the developer of the code to add a few things, most importantly of course being the deletion of the original (old) file copy after the new copy is createdWill - Tracker Supp wrote:For now, this JavaScript (supplied by a user in another topic) can be added to the JavaScripts folder under C:\Program Files\Tracker Software\PDF Editor\JavaScripts:
Rename Doc. Toolbar Button.zip
Thank you again,
Regards
David
David.P
PDF-XChange Pro
PDF-XChange Pro
- Will - Tracker Supp
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
- Contact:
Re: Renaming a pdf when it is opening
Hi David,
As always, no worries at all
Thanks,
As always, no worries at all
For sure, some safeguards like that would definitely be put in place.In order to be 100% on the safe side, the feature then simply would be implemented like so: PDF-XChange Editor first actually closes the current PDF document, then renames it, and finally re-opens it under the new name. In case the re-naming is impossible for some reason, the file just would be opened under the old name again with the error message: "File in use, renaming not possible. Please rename or 'save as' manually"
I don't believe that this is possible. JavaScript in PDF editors/readers is typically fairly well 'sandboxed' for security reasons. If this were allowed, it would then allow anyone to write a malicious script that executes when the document opens and could move files to protected locations as a kind of ransomware, or could simply delete files. We'd also have no way to really protected against it.Thanks for the code! I tried it and I find it amazing that this is possible in PDF-XChange Editor. If I get around to it I may ask the developer of the code to add a few things, most importantly of course being the deletion of the original (old) file copy after the new copy is created
Thanks,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
- Will - Tracker Supp
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
- Contact:
Re: Renaming a pdf when it is opening
Np
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com