cancel
Showing results for 
Search instead for 
Did you mean: 
StefanT-Xerox
FreeFlow User

Re: Fusion of pages

Try writing the pdf to some temp folder before sending it to $FFout$. Like this for instance to the folder C:/Temp/

import shutil
with open("C:/Temp/" + os.path.basename(sys.argv[1]), 'wb') as f:
      output.write(f)
shutil.move("C:/Temp/" + os.path.basename(sys.argv[1]), sys.argv[2])

Please see modified script.

Stefan

NSX
New Member
New Member

Re: Fusion of pages

Hello,

thanks for your input and for taking the time to look at this.

I tested the changed script and with the 'move' line I don't get any file moved to my 'out' folder, it's generated inside C:\Temp and then disappears.

If I comment (#) the 'move' line in the script the PDF stays inside C:\Temp, but it's the same as I had gotten before, it's an exact copy of the original file (no BW pages in the file).

Thanks

Best regards

Nuno

0 Kudos
StefanT-Xerox
FreeFlow User

Re: Fusion of pages

Hi Nuno,

Could it be that the variable for the pages are not evaluated properly for some reason? Try adding print('color') or print('bw') inside the if/else statement like this:

for i in range(infile_color.getNumPages()):
if j in colorpages:
p = infile_color.getPage(i)
output.addPage(p)
j = j + 1
print('color')
else:
p = infile_gray.getPage(i)
output.addPage(p)
j = j + 1
print('bw')

Then check stdout for what has been written. If only 'color' has been printed then

colorpages = ast.literal_eval(sys.argv[4])

is not working for some reason.

Also comment out the lines

os.remove('C:/Out/' + sys.argv[3] + '.pdf')
os.remove('C:/Out/' + sys.argv[3] + '_gray.pdf')

to check what has been saved and that a conversion to grayscale actually has been done.

Stefan

NSX
New Member
New Member

Re: Fusion of pages

Good evening,

after tossing and turning, I got it working.

Apparently was the configuration of the BW conversion in the Manage Color component that wasn't the best.

I had noticed before that page 1 of my example file wasn't being converted from color to BW in the 'grey' document, but all the others were, so I didn't mind it much up until now, because I saw that in fact the newly inserted 'print' commands were logging the correct color/BW page mapping in stdout.

After correcting the Manage Color component and getting the 'grey' document fully converted to BW, the workflow started performing as expected.

Once again, thank you so much for your help and sorry for being such a python-rookie bugger. You rule!

Thanks
Best Regards
Nuno

0 Kudos
StefanT-Xerox
FreeFlow User

Re: Fusion of pages

Great. I am glad you got it working.

Stefan

0 Kudos