How to create a dynamic job list for Xerox printers?

I programmatically create PDF files in Python and Reportlab Toolkit , each of which contains several thousand documents, each document with a variable number of pages.

My problem is that I need to specify a printer on which each page is printed, on which each page is printed (for example, a pre-printed form for the first page of a document). It seems like I need to create some kind of work ticket that stores such information.

I had some success with creating JDF tickets, but they only run on my new computers that run Xerox Freeflow Server version 8.

Ideally, I need a solution that also works with our Freeflow Server 7 and Xerox DocuSP servers. I tried unsuccessfully to send JDF tickets to these printers.

Is there any other type of ticketing system I could use, or a way to get all of our printers to recognize JDF files?

+6
source share
3 answers

I received a response from RogerK-Xerox on the Xerox Support Forum .

Xerox uses an XML-based ticketing system called the Xerox Printing Instruction Format (XPIF). You can get an idea of ​​how this format works by opening your own Xerox print driver, programming some print attributes, and then exporting the Xerox Job Ticket. This can be done by selecting the "Advanced" tab in the print driver, selecting "+" in the "Xerox Job Job" field and selecting "Export Xerox Job Ticket ...", and then click the "Export ..." button.

To get full access to the XPIF programming guide, I believe you need to register at http://www.xerox-solutions.net/Partners

I tried the above and he created an XML file with instructions for scheduling jobs, which could probably be reloaded into the print driver. Now I’m looking for a way to use these files with the printer’s hot folders, which is more in line with our current workflow. The printer will need to know how the XPIF ticket belongs to the PDF file.

It seems that an XPIF file can be added to the top of a PDF file simply by combining the two files. The file can then be dragged into a hot folder, and the Xerox printer knows how to separate the job ticket from the PDF.

I tested this method and it works as expected :-). Adding some arbitrary XML data to the top of the PDF file makes it not openable in Adobe Acrobat. Surprisingly, such files open simply in the Evince Document Viewer.

+1
source

I ran into the same problem. In the end, I found out that I was mistaken due to a misunderstanding of the PDF format. We view PDFs as WYSIWYG for printers. This is not the case. In any kind of print stream, the PDF file is converted to some intermediate format, PostScript , TIFF or PCL usually.

This can happen on your local machine, so you need a driver or on the printer itself. If this happens on the printer, you simply transfer the PDF file to another computer with the conversion system installed.

This is all fine and dandy, except that PDF does not define the order of the pages, which is very inconsistent with the print format. This means that there is no front page of your document, and you cannot define it in any way in a form or form.

You have two solutions:

  • Choose your printer architecture and use your unique method of setting up a media type that is sick and intolerable.

  • Converting to a format that allows you to set the type of media and includes the idea of ​​organizing pages, such as PostScript. Then add your media commands and send this file along with your printer. If your printer has a driver for reading the selected intermediate format, it must convert the commands to its version of multimedia switching. It is more portable, but still not perfect.

This is similar to the idea of ​​converting your C program into an assembly to port it to the new architecture. It basically works, but you have to inspire every system.

Hypothetical conveyor:

Create your PDF file> run it through a PDF-to-PostScript conversion utility or library> run through a custom lexer to add media type commands on each new page> send to a PostScript file to the printer

This is a lot of work, but it is the only thing you will find to solve this problem.

Example

%{ char paper[] = 'yourPaper'; %} %option 8bit outfile="scanner.c" %option nounput nomain noyywrap %option warn %% showpage { printf("showpage\nsetpagedevice MediaType '%s'", paper); } %% int main(int argc, char **argv); int main (argc,argv) int argc; char **argv; { yylex(); return 0; } 

The above is a very simple lexer to find every showpage command received from stdin and output the showpage setpagedevice command set. The setpagedevice MediaType command is an agnostic way to print the type of paper used for the page.

Compile code with flex and GCC :

 flex -Cf scanner.l gcc -O -o lineCount.exe scanner.c 

It takes input through stdin and outputs to standard output.

Below is a more complete lexer. It uses GNU getopts for command line options and has two rules, so it will also set the page device for the first page. This may not ideally capture pages, and it has only one variable for the paper type, so functionality is limited. On the other hand, it is very open, but you want it to determine the page device used.

Either the new rules for recognizing which page he is looking at, or the additional input file with one line on the page are those that immediately come to mind.

 /* * This file is part of flex. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE. */ /************************************************** Start of definitions section ***************************************************/ %{ /* A template scanner file to build "scanner.c". */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <getopt.h> /*#include "parser.h" */ //put your variables here char FileName[256]; FILE *outfile; char inputName[256]; char paper[] = 'yourPaper'; // flags for command line options static int specificFile_flag = 0; static int output_flag = 0; static int help_flag = 0; %} %option 8bit outfile="scanner.c" %option nounput nomain noyywrap %option warn %% /************************************************ start of rules section *************************************************/ /* These flex patterns will eat all input */ EndSetup { printf("showpage\nsetpagedevice MediaType '%s'", paper); } showpage { printf("showpage\nsetpagedevice MediaType '%s'", paper); } %% /**************************************************** Start of code section *****************************************************/ int main(int argc, char **argv); int main (argc,argv) int argc; char **argv; { /**************************************************** The main method drives the program. It gets the filename from the command line, and opens the initial files to write to. Then it calls the lexer. After the lexer returns, the main method finishes out the report file, closes all of the open files, and prints out to the command line to let the user know it is finished. ****************************************************/ int c; // The GNU getopt library is used to parse the command line for flags // afterwards, the final option is assumed to be the input file while (1) { static struct option long_options[] = { /* These options set a flag. */ {"help", no_argument, &help_flag, 1}, /* These options don't set a flag. We distinguish them by their indices. */ {"useStdOut", no_argument, 0, 'o'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; c = getopt_long (argc, argv, "o", long_options, &option_index); /* Detect the end of the options. */ if (c == -1) break; switch (c) { case 0: /* If this option set a flag, do nothing else now. */ if (long_options[option_index].flag != 0) break; printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case 'o': output_flag = 1; break; case '?': /* getopt_long already printed an error message. */ break; default: abort (); } } if (help_flag == 1) { printf("proper syntax is: traySwitch.exe [OPTIONS]... INFILE OUTFILE\n"); printf("adds tray switching information to postscript file\n\n"); printf("Option list: \n"); printf("-o sets output to stdout\n"); printf("--help print help to screen\n"); printf("\n"); printf("inputfile example: traySwitch.exe test.ps\n"); printf("If infile is left out, then stdin is used for input.\n"); printf("If outfile is a filename, then that file is used.\n"); printf("If there is no outfile, then infile-EDIT.ps is used.\n"); printf("There cannot be an outfile without an infile.\n"); return 0; } //Get the filename off the command line and redirect it to input //if there is no filename or it is a - then use stdin. if (optind < argc) { FILE *file; file = fopen(argv[optind], "rb"); if (!file) { fprintf(stderr, "Flex could not open %s\n",argv[optind]); exit(1); } yyin = file; strcpy(inputName, argv[optind]); } else { printf("no input file set, using stdin. Press ctrl-c to quit"); yyin = stdin; strcpy(inputName, "\b\b\b\b\bagainst stdin"); } //Increment current place in argument list optind++; /******************************************** If no input name, then output set to stdout. If no output name then copy input name and add -EDIT.csv. If input name is '-' then output set to stdout, otherwise use output name. *********************************************/ if (optind > argc) { yyout = stdout; } else if (output_flag == 1) { yyout = stdout; } else if (optind < argc){ outfile = fopen(argv[optind], "wb"); if (!outfile) { fprintf(stderr, "Flex could not open %s\n",FileName); exit(1); } yyout = outfile; } else { strncpy(FileName, argv[optind-1], strlen(argv[optind-1])-4); FileName[strlen(argv[optind-1])-4] = '\0'; strcat(FileName, "-EDIT.ps"); outfile = fopen(FileName, "wb"); if (!outfile) { fprintf(stderr, "Flex could not open %s\n",FileName); exit(1); } yyout = outfile; } yylex(); if (output_flag == 0) { fclose(yyout); } printf("Flex program finished running file %s\n", inputName); return 0; } 
+6
source

You should ask your printer vendor (Xerox) about your JDF support specifications for your DocuSp printers.

You may be lucky and get information.

There is no other standardized way to sell tickets than JDF. There are several other vendor-specific methods, and Xerox may have its own. Ask them.

+2
source

Source: https://habr.com/ru/post/888477/


All Articles