Writing a PDL Transform – A practical walkthrough.
Many organizations using PaperCut have taken advantage of Find Me Print to deliver a better printing experience to their users and make better use of their MFD fleet. The PaperCut Global Print Driver greatly improves this scenario by providing a way of abstracting many manufacturer’s devices behind a single print queue.
In some instances, the PaperCut Global Print Driver may not be the right choice for the customer. As an example, the PaperCut Global Print Driver is postscript and may not be supported by the customer’s devices. There is also the case where the customer may have the vast majority of devices made by one manufacturer with one or two devices by another. In this scenario, the customer may prefer to use the dominant vendor driver that suits the majority of their devices to support particular features.
PDL Transforms complete PaperCut’s offerings to ensure Find Me Print is a robust solution in a multi-vendor environment. PDL Transforms allow you to convert the contents of a spool file generated by the driver of one manufacturer to suit the requirements of a device manufactured by another.
PDL Transforms are designed the provide enhanced functionality, supportability and compatibility between two different drivers used in a single print process - E.g. A source print queue with a certain driver, and an output print queue with a different driver. Therefore when the source queue and the output queue have the same driver, any Transforms that have been written will not be used! The process is not called at all. So please ensure that PDL Transforms are only used in environments where the source print queue and the output print queue use different drivers.
This scenario will walkthrough resolving an issue where a duplex document created with a driver suiting the majority of a customer’s MFD fleet does not produce duplex on a device which is of the minority of a customer’s fleet.
- A current version install of PaperCut
- Two print queues created
- One queue created as the ‘majority’ print queue that will be a PaperCut virtual queue. In this case, we’ll use the PaperCut Global Print Driver as the driver choice - called PaperCutIn.
- One queue created as the ‘minority’ print queue which will be a physical queue - called PaperCutOut.
- Create the association in PaperCut that PaperCutIn can forward jobs to PaperCutOut and set the queue to Hold all jobs.
- Pause both queues at the OS level
- Ensure both printers have Advanced Printing Features disabled for both printers.
- Access to a text comparison tool, such as Beyond Compare or Notepad++
- Access to the command line
- Create a basic two page document in any program, ideally a word processor where page breaks are easily created.
- Print the document to the PaperCutIn printer choosing duplex options.
- Navigate to the
C:\Windows\System32\Spool\Printers\folder and find the .SPL file for this job (match on the time of the file of multiple files exist) and save this file someone easily accessible, such as
c:\tempand name it PaperCutIn.SPL
- Repeat steps 2 and three for the PaperCutOut printer.
- At this point we now have the two spool files to compare. This part of the process is more art than science, as we need to make an educated guess as to the commands in the PaperCutOut.SPL file that are missing from the PaperCutIn.SPL file that would make the minority device out duplex. An example of this is shown below using Beyond Compare to show the differences in the two files. There will be many differences, though we’re looking for those relevant to Duplex or its synonyms.
- In this block of text, there is a difference of note;
Beyond Compare will help you move this difference from the PaperCutOut.SPL file to the PaperCutIn.SPL file.
- In this example, another difference of note appears. A block of code;
%%BeginFeature: *OptionalDuplexer True
would also be worthy to move across to the PaperCutIn.SPL file.
- In the absence of any other differences of note, you can save the PaperCutIN.SPL file and submit this print job to the PaperCutOut printer to see the results.
- First clear the held print job in the PaperCutOut queue and unpause the queue.
- Open a command line, and navigate to C:\temp and type in the command
copy /b PaperCutIn.SPL \\localhost\PaperCutOut
This will submit the spool file to the printer via the windows queue.
- Assuming you have had success, we are now ready to write our PDL Transform to programmatically apply these transforms in real time when print jobs are received.
- Using a text editor, begin a new text file with the lines
#Turn on debug
The # indicates a comment line, and
ENABLE_TEST_MODEenables logging for the PDL Transform process. A full list of these commands and definitions can be found here.
- In Step 6, we identified that we wanted to insert a command after the
%%BeginSetupsection of the spool file. The most effective way to achieve this is if the document is duplex, find and replace
%%BeginSetupwith our new command using the statement below.
IF pc_duplex THEN FIND "%%BeginSetup" REPLACE
- We inserted the code in Step 7 above the
%%BeginFeature: *HardDisk Falseline. Again, we can find and replace this line with our new code if the input spool file is duplex.
IF pc_duplex THEN FIND """%%BeginFeature: *HardDisk False""" REPLACE """%%BeginFeature: *OptionalDuplexer True
%%BeginFeature: *HardDisk False"""
- We have now written a transform that will insert the appropriate commands to create a duplex output on our chosen device. We now need to save this transform in such a way that PaperCut will make use of it. The path format for saving transforms is documented in the link previously provided. In this case, I’m saving my transform as;
- Repause the PaperCutOut queue, and send a print to your PaperCutIn queue. Release the job via the Jobs Pending Release tab of the PaperCut Admin Web UI to both move the job to the PaperCutOut queue and most importantly apply the transform.
- If you navigate to the
you should find a
.afterfile. The .after file should be the PaperCutIn.SPL file with you transforms applied. Searching for the same text you searched for in your transform should allow you to see your results (search for
Keywords: PDL Transform, Global Print Driver, Cross-vendor Printing