PDF-XChange Viewer & TeX: please don't lock the file

The PDF-XChange Viewer for End Users
+++ FREE +++

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
halabund
User
Posts: 44
Joined: Mon Aug 27, 2007 7:13 am

PDF-XChange Viewer & TeX: please don't lock the file

Post by halabund »

Are there any plans to make PDF-XChange Viewer more usable with LaTeX?

One of the big annoyances for LaTeX users is that most PDF viewer lock the file they are displaying, so the .tex sources cannot be recompiled until the viewer is closed.

There are some PDF viewers which do not lock the file (like Sumatra or GSView), but these are not very usable. It would be very nice if PDF-XChange offered a feature to allow overwriting the PDF that is currently displayed (and to automatically re-open it if it has been overwritten).

If it is not possible to implement this, are there any solutions similar to pdfopen/pdfclose available for PDF-XChange viewer?

http://magic.aladdin.cs.cmu.edu/2005/07 ... -pdfclose/

pdfopen/pdfclose work reasonable well with Adobe Reader, but it is very annoying that the --back option (go back to the last displayed page) does not work with the free Reader (the paid version of Acrobat is required for this).
halabund
User
Posts: 44
Joined: Mon Aug 27, 2007 7:13 am

Post by halabund »

So is there not way to use PDF XChange Viewer as a document previewer with LaTeX?
CrendKing
User
Posts: 6
Joined: Tue Mar 04, 2008 9:38 am

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by CrendKing »

I have the same problem. Viewer team, please make the viewer not lock the file, and detect the change periodically. I know it may threaten the performance when scrolling, but it is reasonable to leave an option for it. Thanks!
CrendKing
User
Posts: 6
Joined: Tue Mar 04, 2008 9:38 am

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by CrendKing »

Probably we can only use the command line options (e.g. /close) in script or batch to archive LaTeX regenerate.
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Lzcat - Tracker Supp »

Sorry,

But the Viewer must lock a file to display the pdf on screen - it does not keep everything in memory, so it needs to source the file unchanged until it is closed.

Maybe some form of non exclusive mode will be added in the future, but for now I can not say anything more specific.

And yes, for now you should use /close:mode=discard <filename> to close an already opened document before updating it.

HTH
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
airblaster
User
Posts: 2
Joined: Sat May 09, 2009 3:17 pm

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by airblaster »

No non-locking mode for now? Guess I don't have any other choice than going on to a different reader - FoxIt, Sumatra, gsview, therese just so many readers supporting it.
Please don't misunderstand - I really like the X-Change viewer. But I'm working on a large document with LyX, and I need previewing all the time. Its just too time-consuming to close X-Change viewer every time.
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Lzcat - Tracker Supp »

We cannot open file in non-blocking mode - the PDF file as a whole is required to display, so non-blocking only possible in two ways - load everything in memory (very "good" idea for large files) or create a copy of file and open it.

And for now you should not close the Viewer, but only the file in View (see command line in my previous post). Of course it will take time to open the file again, but this will remain even so in non-blocking mode.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
quant
User
Posts: 151
Joined: Fri Jan 18, 2008 2:48 pm

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by quant »

airblaster wrote:No non-locking mode for now? Guess I don't have any other choice than going on to a different reader - FoxIt, Sumatra, gsview, therese just so many readers supporting it.
Please don't misunderstand - I really like the X-Change viewer. But I'm working on a large document with LyX, and I need previewing all the time. Its just too time-consuming to close X-Change viewer every time.
closing just the file works very well, I'm using pdf-xchange viewer with miktex/winedt combination for about a year without problem
airblaster
User
Posts: 2
Joined: Sat May 09, 2009 3:17 pm

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by airblaster »

Closing the file before compiling doesnt work for me - there is no such option in LyX.

If non-blocking mode is not possible, why is supatra pdf viewer capable of opening a file without locking it? Does Sumatra load the whole file?

I'd be happy with a commandline-option that handles pdf the same way as sumatra. I would only use it for the documents I'm writing myself anyway.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17901
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Tracker Supp-Stefan »

Hi airblaster,

non-locking mode is not possible for our Viewer, as if this is available almost anything but rendering the document on your screen would be not usable as functionality. The Viewer needs to "control" the file and needs to be certain it can complete the operations it attempts - hence the locking. While simply rendering the file on your screen is what you need 99% of the other users do need something more - so there always has to be some compromise.

Those other Viewers you mention might be offering read only mode but at a price. For the moment we feel this is the best way our Viewer to work, and I am sorry if it does not meet your needs.

I would also recommend you to consider some of the other alternatives of editting software + our Viewer mentioned in this topic.

Best Regards,
Stefan
Danstroem
User
Posts: 3
Joined: Fri Apr 13, 2012 8:50 am

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Danstroem »

I came across the same problem and solved it with a workaround. Save a file called pdfReopen.bat with the following content:

Code: Select all

@echo off

set PDFXC="C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe"

set pdfFile=%1
set pdfFile=%pdfFile:/=\%
set pdfFile2=%pdfFile:.pdf=2.pdf%

%PDFXC% /close:mode=discard %pdfFile2%
copy %pdfFile% %pdfFile2%
start "" %PDFXC% %pdfFile2%
exit
You may have to modify the path to PDFXCview.exe, according to your installation. The code copies the final pdf from lyx to a new file and then opens the copy in PDF-XChange. The original file does not get locked and everything is fine :-)

In Lyx, you go to Tools->Preferences->File handling->File formats->PDF (pdflatex) and in the Viewer textfield, you replace "pdfview" with the full path to the batch file, for example: C:\Users\Username\Documents\Programs\pdfReopen.bat

edit: If the full path contains one or more spaces, you instead have to append the directory path to the .bat file to the PATH-Prefix in Tools->Preferences->Paths without quotes and without trailing backslash, for example: C:\Users\Username\Documents\Programs . The Viewer textfield of PDF (pdflatex) then only has to contain the name of the .bat file without path: pdfReopen.bat . Maybe you have to restart Lyx.
Last edited by Danstroem on Wed Apr 18, 2012 8:43 am, edited 1 time in total.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17901
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Tracker Supp-Stefan »

Many thanks for the idea Danstroem,

Hope it would be useful to other TeX Users as well.

Best,
Stefan
Ginfer
User
Posts: 17
Joined: Sun Dec 05, 2010 1:25 pm

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Ginfer »

Well, maybe this could be implemented as a command-line parameter, which instructs the viewer to copy the file it to a %temp%\someuniquename folder first and then opens it in read-only mode (because writing a temporary file would make no sense).
User avatar
BigMike
User
Posts: 307
Joined: Wed Nov 07, 2007 10:07 am

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by BigMike »

Actually you can open a PDF in non-blocking mode in the proposed way:

Code: Select all

PDFXCview.exe /A "nolock=yes=OpenParameters" <PDF-File>
tries to create a temporary copy and - in case of success - works on the temporary file and leaves the original unblocked. See here for a detailed information about the viewer's behavior.
Danstroem
User
Posts: 3
Joined: Fri Apr 13, 2012 8:50 am

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Danstroem »

Hey BigMike,

thanks for your advice! Tried it, and opening in non-blocking mode works. The label on the top shows "non-blocking". Unfortunately updates of the original file are not kept track of. The first open works. On updates, Latex can write to the original PDF file, while it is opened in non-blocking mode, which is good! I verified, that Latex correctly updates the original PDF. PDF-XChange however doesn't notice the update and still displays the old version, even if called again with /A "nolock=yes=OpenParameters". Seems a bit odd, as in the corresponding thread it says, that the original file is kept track of changes...?

I am using Windows 7 64bit with PDF-XChange 2.5 (Build 201.0).

edit: I'm talking about the PDF-XChange Viewer, sorry for the inconvenience!
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17901
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Tracker Supp-Stefan »

Hello Danstroem,

Is the file local or on a network drive? And also do you remember ever selecting to "not show this message again" - for any prompt in our Viewer? Could it be that you've simply selected to no longer see the "The source file has changed - would you like to update it in the Viewer" kind of message that our Viewer shows.

Also please check this particular post I've made before:
https://forum.pdf-xchange.com/ ... 782#p50782
And the rest of that topic as it might be of interest to all TeX users.

Best,
Stefan
Danstroem
User
Posts: 3
Joined: Fri Apr 13, 2012 8:50 am

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Danstroem »

Hi Stefan,

it is a local file in C:\Users\Username\AppData\Local\Temp. I once hit "not show this message again" for closing tabs on exit, but not for anything other. Never saw something like a "The source file has changed" message. I reset the preferences, but it didn't help. I'll not investigate further, as the workaround in Post 58698 is just fine. No messages to click on, just the update :-)

Thanks for your time! PDF-XChange Viewer is great!
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17901
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF-XChange Viewer & TeX: please don't lock the file

Post by Tracker Supp-Stefan »

Glad to assist Danstroem!

So we'll consider this resolved - with the workaround posted above in the topic as the solution!

Cheers,
Stefan
Post Reply