opening pdf files in Zotero
Below is my original question, posted to a different discussion, with adamsmith's response. He said I should start a new thread for this topic, which I am doing here. I tried your suggestion, which makes perfect sense, in both Zotero for Firefox and Standalone Zotero, but changing the launch NonNative files hidden preference to true didn't make a difference in either case.
This is a simpler problem, but I don't know the best place to raise it. I don't save pdf files with my Zotero database, but rather in a separate directory on my computer. If I have a pdf copy of a paper in my database, I show the location of that pdf in the URL field. When I open that pdf from Zotero in Firefox, it opens in a window without editing capabilities (highlighting, commenting, deleting pages, etc.). I use Adobe X Pro, which is what my installation of Firefox is set to use. I've discovered that this constraint is a consequence of Firefox, not Zotero or Adobe X Pro. However, when I try to open a stored pdf in Zotero Standalone, the pdf opens in a window that can't be moved or resized. The window may show only the closed button in the upper right, or it may not show the top bar of the window at all. I use Windows XP.
Can you tell me how to fix this?
Thanks,
Steve Jenkins
so you want the PDF to just open in Adobe Pro?
Set the launchNonNative Files hidden preference to true:
http://www.zotero.org/support/preferences/hidden_preferences
This is a simpler problem, but I don't know the best place to raise it. I don't save pdf files with my Zotero database, but rather in a separate directory on my computer. If I have a pdf copy of a paper in my database, I show the location of that pdf in the URL field. When I open that pdf from Zotero in Firefox, it opens in a window without editing capabilities (highlighting, commenting, deleting pages, etc.). I use Adobe X Pro, which is what my installation of Firefox is set to use. I've discovered that this constraint is a consequence of Firefox, not Zotero or Adobe X Pro. However, when I try to open a stored pdf in Zotero Standalone, the pdf opens in a window that can't be moved or resized. The window may show only the closed button in the upper right, or it may not show the top bar of the window at all. I use Windows XP.
Can you tell me how to fix this?
Thanks,
Steve Jenkins
so you want the PDF to just open in Adobe Pro?
Set the launchNonNative Files hidden preference to true:
http://www.zotero.org/support/preferences/hidden_preferences
1) In Adobe Acrobat X Pro, Preferences, Internet -- turn off display in browser default.
2) In Firefox 19.0.2, use about:config to set hidden preferences (these aren't Zotero preferences, but Firefox ones). Set pdfjs.disabled to True.
3) In Firefox, Options, Applications -- specify Use Adobe Acrobat for Adobe Acrobat files.
The Zotero option to launchNonNativeFiles can remain set at False.
In Zotero Standalone, changing this hidden preference doesn't solve the problem.
Thanks
Steve J.
I don't think we've ever heard of such an issue with Standalone and presumably many people are working on set-ups similar to yours.
Try this: http://www.zotero.org/support/kb/file_handling_issues#unexpected_behavior_wrong_action_gibberish_pdf_etc_when_opening_files_from_zotero
If that doesn't work, could you tell me which application opens the PDF from Zotero Standalone?
I mostly use Zotero FF, so it's not that critical to get Standalone to open pdf files properly, but I'm still curious, especially since others evidently haven't reported the same problem.
"fname (application/ pdf Object) when the pdf window is opened from Zotero Standalone, and this task disappears when the pdf window is closed (which is all I can do when I open it from Zotero Standalone because the minimize and maximize buttons are missing).
I did a quick Google search for "application / pdf Object" and found some comments suggesting that this string is used to deal with pdfs in programming, leading me to suspect that there is something in the Zotero Standalone program causing this behavior, though I'm surprised that no other users have mentioned it.
Steve J.
I dont' think I can help you any further unless we get more reports on this.
I'm still surprised you can't tell which PDF viewer you're looking at - as I say, every pdf viewer has a distinct layout - things like how the cursor looks, how you select text, the right-click menu etc.
For many records in my Zotero database, I have a pdf file that I store in a location on my hard disk. I use the URL field to record this link (for other records, the URL field points to a web address). I use Acrobat X Pro as my pdf reader. Version 5 of Zotero opens a gratuitous empty window as well as another window containing the pdf file when I click on a record that contains a reference to the pdf file in the URL field of my Zotero database. This minor problem didn't occur in previous versions of Zotero.
Thanks for any help you can provide.
Steve Jenkins
I guess the gratuitous empty window is not a bug in Zotero 5 per se, but rather a consequence of using the standalone version of Zotero, which I like otherwise (and am well-adjusted to using with Chrome after using Firefox with the Zotero add-on for many years).
I think the gratuitous empty window is not a bug in Zotero 5 in this case. The Zotero try to open URL in the web browser. Standard function of all web browsers is open HTML format, not open PDF format. Open other formats in the web browser windows is an additional function. And it seems like the current web browser in the Zotero does not have this function. It is not a bug, it is a limitation.
Thanks,
Steve Jenkins
I'm not aware of any workarounds other than copy&pasting the file URIs into your browser or explorer window.
c:\data\pdf files\fname.pdf
e.g., c:\data\pdf files\breck_2019.pdf
Thanks,
Steve Jenkins
But to answer your question from five years ago, here's a script you can use to convert all the incorrect URL-field values to linked-file attachments. Before you run it, you should 1) temporarily disable syncing in the Sync pane of the preferences and 2) close Zotero and make a backup of the zotero.sqlite file in your Zotero data directory.
Once you've done that, go to Tools → Developer → Run JavaScript, paste in this code, and run it:
var s = new Zotero.Search();
s.libraryID = Zotero.Libraries.userLibraryID;
s.addCondition('url', 'beginsWith', 'C:\\');
var ids = await s.search();
if (!ids.length) {
return "No items found";
}
var output = "";
var numUpdated = 0;
for (let id of ids) {
let item = await Zotero.Items.getAsync(id);
let path = item.getField('url');
try {
if (!await OS.File.exists(path)) {
output += "Skipping missing file " + path + "\n";
continue;
}
await Zotero.Attachments.linkFromFile({
parentItemID: item.id,
file: path
});
item.setField('url', '');
await item.saveTx({
skipDateModifiedUpdate: true
});
numUpdated++;
}
catch (e) {
Zotero.logError(e);
}
}
return output + "\n" + numUpdated + " item(s) updated";
If there's a problem, close Zotero and replace zotero.sqlite in your data directory with the backup.
You can turn syncing back on afterward if you're happy with the results.
I don't have as many of these records as I thought -- 225 out of 4142 total records. So I can gradually fix this manually, by adding attachments to these 225 records and changing the url data to online links.
There's no need to fix these manually.
return output + "\n" + numUpdated + " item(s) updated";
to after this line
numUpdated++;
and got output for 3 records in the right pane, but nothing more.
Thanks again for your help.
Steve Jenkins
You can go to Help → Debug Output Logging → View Output to see whether Zotero is still doing anything while it's running.