cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Batch Publishing Arbortext Editor

ptc-6137410
5-Regular Member

Batch Publishing Arbortext Editor

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?

Thank you

15 REPLIES 15

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":

ptc-6137410
5-Regular Member
(To:GarethOakes)

In addition to the previous posts, is there documentation for writing ACL, especially for Arbortext Editor Release 6.0?

Thank you

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.

ptc-6137410
5-Regular Member
(To:GarethOakes)

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.

Thank you

 

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.

ptc-6137410
5-Regular Member
(To:GarethOakes)

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

ptc-6137410
5-Regular Member
(To:DmitryTsarev)

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?

Are you still getting Java errors? Or some Arbortext exceptions? Or PDFs just don't get generated?

What Arbortext version are you on? Can you share a sample .xml + .xsl?

 

Getting some more info from your side would help, otherwise it's pretty much groping, not searching for the right answer.

ptc-6137410
5-Regular Member
(To:DmitryTsarev)

REM publish files in directory

for %%i in (C:\Users\123\Desktop\oldPDFname\*.xml) do (

"C:\Program Files\PTC\Arbortext Editor\bin\x64\editor.exe" -c "print composed printer='Microsoft Print to PDF' file='%%i.pdf'" %%i -stylesheet '\\hsv-ptc\IETMS\doctypes\40051C_3_29\xslfo-main-v1_9.xsl' -styler

)

With this, nothing gets generated---no Java Error logs, no PDFs.

 

If I leave off ‘-styler’, I'll get an Error that the xslfo-main-v1_9.xsl is not a valid Arbortext Editor stylesheet and a log file is created for Java Runtime Environment Exception_access_violation with each instance. No PDFs.

 

If I change xslfo-main-v1_9.xsl to 40051C_3_29.fos and leave off '-styler', there’s an alert that the .xml is in use by another application, open as read only, and a Java Runtime Environment Exception_access_violation log is created for each instance. No PDFs.

 

If I keep ‘-styler’ with the .fos, no errors, no logs and no PDFs are created.

 

I’ve attached an example .xml and PDF that was published in arbortext using xslfo-main-v1_9.xsl stylesheet and standard.pdf config file.

 

ptc-6137410
5-Regular Member
(To:ptc-6137410)

This is Arbortext Editor 6.0

I don't have much experience doing such kind of things (normally people do it with Arbortext Publishing Engine) so I was going to try to reproduce the issue on my side, but without .xsl or .fos I'm not able to do it.

 

Other than that it's hard to give any advice / suggest solutions on such kind of issues and without having hands-on experience.

ptc-6137410
5-Regular Member
(To:DmitryTsarev)

To test on a single file to see if it will publish using command line, I tried the following .acl.

(If I use File>Publish>PDF File the stylesheet is tied to a publishing engine and specific xslfo-main-v1_9.xsl and standard.pdfcf.)

Whenever I implement the following, it says params["stylesheet"] is missing argument [A11320]. Are there other local parameters I need to include in the .acl?

 

function test_cfg::test2() {
 local params[];
 params["outputfFile"] = 'C:\Users\x\Desktop\oldPDFname\m02133.pdf'; 
 params["stylesheet"]=
 '\\Program Files\PTC\custom\custom\doctypes\40051C_3_29\xslfo-main-v1_9.xsl';
 local rc = compose::compose_for_pdf(current_doc(), params);
 return rc;
}

If that is literally the code you're using then obviously '\\Program Files\...' is wrong. C:\Program Files\ is the usual path. A double backslash tries to resolve a UNC path name. I also don't know if backslash is an escape character, why not try something like response(params["stylesheet"]) and response(params["outputFile"]) to ensure the correct values are being used.

Top Tags