Is there a way to incorporate Python to open all .xml files in a directory and publish each one? If not with Python, is there a way to batch Publish files?
This is a very common question. In general, the answer is "yes" but not via Python - unless you want to call out from Python to the command shell to execute the tasks. The better way is to use ACL scripts which run inside Arbortext and avoid having to shutdown and restart the application between each composition request.
Please review some of the previous answers, or search this forum for "batch":
In addition to the previous posts, is there documentation for writing ACL, especially for Arbortext Editor Release 6.0?
I think there are training courses you can take, but if you are familiar with Perl then you will find ACL very similar. The Arbortext Help Center includes complete reference documentation, and you will find the product itself ships with lots of ACL code in the *.acl files that you can use for reference.
My goal is to PDF publish a batch of .xml in a directory; however, I tested with a single file to help isolate my issues.
With Arbortext and the .xml file open, I’m able to use Arbortext’s command line to call the stylesheet and publish the PDF:
print composed printer='Microsoft Print to PDF' stylesheet='e3:E:\Program Files\PTC\LMCO_custom\custom\doctypes\40051C_3_29\xslfo-main-v1_9.xsl' file='m02133.pdf'
I’m unable to publish this in PowerShell. I thought I’d use:
C:\Program Files\PTC\Arbortext Editor\bin\x64> .\editor.exe -c print composed printer='Microsoft Print to PDF’ file='C:\Users\e286393\Desktop\oldPDFname\m02133.xml' 'm02133.pdf'
Somehow my syntax is wrong.
Also, I tried to create an .acl script and save to PTC\Arbortext Editor\custom\scripts however, I don’t have the permissions I need to access and write to the folder. I researched to see how else I could direct Arbortext to read an ACL but I haven’t found how to route the path.
Any further assistance would be appreciated.
I don't have time to test this out but you're on the right path. You probably just need to put your command in double-quotes for the shell to not pass each item as a separate parameter.
I ended up running a .bat (below) to iterate over the .xml and publish as .pdf. However, it's creating a log file for each work package for a Java Runtime Environment: Exception_Access_Violation. I ran as admin but still get the same issue. Any guidance?
for %%i in (C:\Users\e286\Desktop\oldPDFname\*.xml) do (
"C:\Program Files\PTC\Arbortext Editor\bin\x64\editor.exe" -b -c "print composed printer='Microsoft Print to PDF' stylesheet='e3:E:\Program Files\PTC\custom\doctypes\40051C_3_29\xslfo-main-v1_9.xsl'" %%i
If you google the error message online you might find some clues, but I'm afraid this doesn't ring any bells for me.
for %%i in (c:\Users\tsar\Desktop\Rdr_Test\__bat\*.dita) do ( c:\PTC\ArbortextPE\bin\x64\editor.exe -c "print composed printer='Microsoft Print to PDF' file='%%i.pdf'" %%i -stylesheet 'c:\Users\tsar\Desktop\Rdr_Test\ditabase_fo.style' -styler )
works for me. See the attached video
Thank you for your help and video! Unfortunately this still did not result in the pdfs being published. I wonder if somehow the stylesheet isn't being recognized even though I reference a relative path for the network it's saved to. I'll research some more. I think I'm close with the syntax provided in the example above. Only other thought is if the *.dita files are treated differently than .xml through the editor.exe, would a standard.pdfcf (config file) need specified in the .bat?