cancel
Showing results for 
Search instead for 
Did you mean: 
25 Replies
barwapk
Valued Member
Valued Member

Re: Save/Export to EPS

Jump to solution

This works perfectly, thak You one more time for Your help :)

0 Kudos
StefanT-Xerox
FreeFlow User

Re: Save/Export to EPS

Jump to solution

I don't have that issue. Perhaps your Acrobat holds on to it for some reason. Try this:

Remove the Save node from the workflow and change the script like this to get the pdf directly from sys.argv[1] - $FFin$:

import os
import sys   
import winerror
from win32com.client.dynamic import Dispatch, ERRORS_BAD_CONTEXT

ERRORS_BAD_CONTEXT.append(winerror.E_NOTIMPL)

#my_dir = r"C:\Out"
my_dir = os.path.dirname(sys.argv[1])
#my_pdf = sys.argv[3] + ".pdf"
my_pdf = os.path.basename(sys.argv[1])
out_dir = r"C:\Out"
#my_pdf = "test.pdf"

os.chdir(my_dir)
src=os.path.abspath(my_pdf)

try:
    AvDoc = Dispatch("AcroExch.AVDoc")   

    if AvDoc.Open(src, ""):           
        pdDoc = AvDoc.GetPDDoc()
        jsObject = pdDoc.GetJSObject()
        jsObject.SaveAs(os.path.join(out_dir, sys.argv[3] + ".eps"), "com.adobe.acrobat.eps")
        #jsObject.SaveAs(os.path.join(my_dir, "test.eps"), "com.adobe.acrobat.eps")

except Exception as e:
    print(str(e))

finally:       
    AvDoc.Close(True)

    jsObject = None
    pdDoc = None
    AvDoc = None

 

barwapk
Valued Member
Valued Member

Re: Save/Export to EPS

Jump to solution

It works as it should but i have one problem, I cant delete PDF from C:\Out after script saves EPS. It says that the file is opened.

0 Kudos
barwapk
Valued Member
Valued Member

Re: Save/Export to EPS

Jump to solution

Thank You for Your help, in my case error was becouse I have Python in other location and I have to change it it .bat file. I will check if everything work as it shoud today.

0 Kudos
StefanT-Xerox
FreeFlow User

Re: Save/Export to EPS

Jump to solution

A couple of more notes. I noticed that the resulting EPS was different when running the Python script standalone versus in a FreeFlow Core workflow. To be able to use the settings for the EPS conversion in Acrobat I had to set the FreeFlow Core Windows service user to the same user creating the EPS conversion settings in Acrobat. In Acrobat go to Edit->Preferences->General->Convert From PDF->Encapsulated PostScript->Edit settings and select your required settings. You might need to change the Security settings also to allow Acrobat to be run by some other application or user than what is default. Right click on Acrobat.exe and check the Security tab (I simply set it to full control for all application packages and users). Once you have created the EPS from Python standalone or if you did the same in a FreeFlow Core workflow, then open the created EPS in some text editor. In the first few lines you should see who the file was created for (%%For:).

%!PS-Adobe-3.1 EPSF-3.0
%ADO_DSC_Encoding: Windows Roman
%%Title: test.pdf
%%Creator: Adobe Acrobat 20.9.0
%%For: <user name>

0 Kudos
StefanT-Xerox
FreeFlow User

Re: Save/Export to EPS

Jump to solution

This works for me...

First a Save node

save to out.PNG

Then an External Process

 

export eps.PNG

Where the batch file looks like this:

"C:\Program Files\Python38\python.exe" "C:\Xerox\FreeFlow\Core\00000000-0000-0000-0000-000000000000\Data\Scripts\save_as_eps_from_acrobat_pro_dc.py" %1 %2 %3

and the Python script like this:

import os
import sys   
import winerror
from win32com.client.dynamic import Dispatch, ERRORS_BAD_CONTEXT

ERRORS_BAD_CONTEXT.append(winerror.E_NOTIMPL)

my_dir = r"C:\Out"
my_pdf = sys.argv[3] + ".pdf"
#my_pdf = "test.pdf"

os.chdir(my_dir)
src=os.path.abspath(my_pdf)

try:
    AvDoc = Dispatch("AcroExch.AVDoc")   

    if AvDoc.Open(src, ""):           
        pdDoc = AvDoc.GetPDDoc()
        jsObject = pdDoc.GetJSObject()
        jsObject.SaveAs(os.path.join(my_dir, sys.argv[3] + ".eps"), "com.adobe.acrobat.eps")
        #jsObject.SaveAs(os.path.join(my_dir, "test.eps"), "com.adobe.acrobat.eps")

except Exception as e:
    print(str(e))

finally:       
    AvDoc.Close(True)

    jsObject = None
    pdDoc = None
    AvDoc = None

/Stefan

 

0 Kudos
barwapk
Valued Member
Valued Member

Re: Save/Export to EPS

Jump to solution

OK, this "manual" script works, how to make it works with Core?

0 Kudos
StefanT-Xerox
FreeFlow User

Re: Save/Export to EPS

Jump to solution

I have Acrobat Pro DC 2020. Try running it oustide FFCore first just with Python only and without a batch file. I run it like this, where I have a test pdf C:\Out\test.pdf and the result I get after running this with Python is an EPS C:\Out\test.eps

import os
import sys   
import winerror
from win32com.client.dynamic import Dispatch, ERRORS_BAD_CONTEXT

ERRORS_BAD_CONTEXT.append(winerror.E_NOTIMPL)

my_dir = r"C:\Out"
#my_pdf = sys.argv[3] + ".pdf"
my_pdf = "test.pdf"

os.chdir(my_dir)
src=os.path.abspath(my_pdf)

try:
    AvDoc = Dispatch("AcroExch.AVDoc")   

    if AvDoc.Open(src, ""):           
        pdDoc = AvDoc.GetPDDoc()
        jsObject = pdDoc.GetJSObject()
        #jsObject.SaveAs(os.path.join(my_dir, sys.argv[3] + ".eps"), "com.adobe.acrobat.eps")
        jsObject.SaveAs(os.path.join(my_dir, "test.eps"), "com.adobe.acrobat.eps")

except Exception as e:
    print(str(e))

finally:       
    AvDoc.Close(True)

    jsObject = None
    pdDoc = None
    AvDoc = None

0 Kudos
barwapk
Valued Member
Valued Member

Re: Save/Export to EPS

Jump to solution

OK, now when i try:

PS C:\Xerox\FreeFlow\Core\00000000-0000-0000-0000-000000000000\Data\Scripts> python save_as_eps_from_acrobat_pro_dc.py "C:\in\testCIECIE.pdf" "C:\Out" "testCIECIE"

Acrobat it opening and it says "file not found"

Am I giving paramterers correctly? 

 

edit I have Adobe Acrobat 2017, meaby this is an issue?

0 Kudos
StefanT-Xerox
FreeFlow User

Re: Save/Export to EPS

Jump to solution

Try:

pip install pywin32

0 Kudos