[dvipdfmx] [texworks] [XeTeX] Adobe PDF, Adobe Acrobat/Reader, Microsoft Word, XeTeX, and (x)dvipdfm(x).

Stefan Löffler st.loeffler at gmail.com
Fri Jun 4 14:52:45 CEST 2021


Hi Philip,

On 29.05.21 11:22, Philip Taylor wrote:
> Hallo Akira-san, and many thanks for the information.  As far as I can 
> see, the real problem lies in the fact that "only documents opened by 
> `pdfopen' can be closed by `pdfclose'" [This is a problem because 
> TeXworks appears not to use `pdfopen' when instructed to "Print 
> PDF..."].  I assume that this restriction exists because `pdfopen' 
> obtains some sort of descriptor/handle to the file which it has 
> opened, which it then uses to close the file, but I have checked and 
> ascertained that MS Word does not suffer from this problem — I can 
> open a Word-generated PDF by double-clicking on it in Windows 
> Explorer, and if I then open the original Word document and tell it to 
> "Save as PDF", Word manages to tell Adobe Acrobat to close the file 
> even though it did not initiate the open.  I therefore have two 
> questions :
>
>  1. Is there any possibility that `pdfclose' could be enhanced such
>     that `pdfclose' can open any currently open PDF, not just one that
>     it has itself opened; and
>

In principle, yes (if I understand you correctly) - at least for 
Acrobat. https://www.adobe.com/go/acrobatsdk_iacguide lists a 
CloseAllDocs() function. There doesn't seem to be an easy way to get a 
list of all open files, though.

>  1. Would it be possible to develop a `pdfDDE' program that would
>     iterate over the known set of DDE server names and report which
>     (if any) allow successful communication with the server, as
>     determining the DDE server name appears to be somewhat problematic ?
>

Yes, it seems to be possible to communicate with all DDE-aware 
applications (see 
https://docs.microsoft.com/en-us/windows/win32/dataxchg/using-dynamic-data-exchange). 
However, many of them may not be PDF readers, and their way of 
communicating (supported commands, etc.) are application-specific as 
well. So without knowing what to look for, it seems impossible to 
actually find something useful.
That being said, according to 
https://wiki.tcl-lang.org/page/Howto+open+PDF+with+Adobe+Acrobat+or+Reader+using+DDE, 
it might be possible to determine the DDE name of a (properly installed) 
Acrobat version from the registry (assuming the syntax doesn't change 
from version to version).

> In the meantime I will raise this issue on the TeXworks list, since if 
> TeXworks could use `pdfopen' and `pdfclose' (the former when 
> instructed to "Print PDF...", the latter before calling XeTeX), then 
> that would address at least a part of the current problem.
>

I'm reluctant to force the use of pdfopen, as this is a separate 
program/script that need not be installed (it definitely isn't on my 
(Linux) system). I could imagine, though, implementing the possibility 
to run certain commands before typesetting, such as sending DDE command 
to Acrobat on Windows), similar to what I think is done in TeXnicCenter 
and probably others.

Does anyone have any experience with other PDF readers? Is the same 
problem (no write access to open pdfs) present in, e.g., FoxitReader, 
SumatraPDF, etc.? Or is it just Adobe-specific?

HTH
Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210604/df08e2a6/attachment.html>


More information about the dvipdfmx mailing list.