Choose your language

Choose your login

Contact us

Writing a PDL Transform – A practical walkthrough.

THE PAGE APPLIES TO:

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.

IMPORTANT NOTE
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.

Scenario

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.

What you will need

  1. A current version install of PaperCut
  2. Two print queues created
    1. 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.
    2. One queue created as the ‘minority’ print queue which will be a physical queue - called PaperCutOut.
    3. Create the association in PaperCut that PaperCutIn can forward jobs to PaperCutOut and set the queue to Hold all jobs.
    4. Pause both queues at the OS level
    5. Ensure both printers have Advanced Printing Features disabled for both printers.
  3. Access to a text comparison tool, such as Beyond Compare or Notepad++
  4. Access to the command line

Process

  1. Create a basic two page document in any program, ideally a word processor where page breaks are easily created.

  2. Print the document to the PaperCutIn printer choosing duplex options.

  3. 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:\temp and name it PaperCutIn.SPL

  4. Repeat steps 2 and three for the PaperCutOut printer.

  5. 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.

  6. In this block of text, there is a difference of note;
    «/Duplex true»setpagedevice
    Beyond Compare will help you move this difference from the PaperCutOut.SPL file to the PaperCutIn.SPL file.

  7. In this example, another difference of note appears. A block of code;
    featurebegin{
    %%BeginFeature: *OptionalDuplexer True

    %%EndFeature
    }featurecleanup
    would also be worthy to move across to the PaperCutIn.SPL file.

  8. 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.

  9. First clear the held print job in the PaperCutOut queue and unpause the queue.

  10. 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.

  11. 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.

  12. Using a text editor, begin a new text file with the lines
    #Turn on debug
    ENABLE_TEST_MODE
    The # indicates a comment line, and ENABLE_TEST_MODE enables logging for the PDL Transform process. A full list of these commands and definitions can be found here.

  13. In Step 6, we identified that we wanted to insert a command after the %%BeginSetup section of the spool file. The most effective way to achieve this is if the document is duplex, find and replace %%BeginSetup with our new command using the statement below.
    IF pc_duplex THEN FIND "%%BeginSetup" REPLACE
    """%%BeginSetup
    «/Duplex true»setpagedevice"""

  14. We inserted the code in Step 7 above the %%BeginFeature: *HardDisk False line. 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

    %%EndFeature
    }featurecleanup
    featurebegin{
    %%BeginFeature: *HardDisk False"""

  15. 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;
    [install-path]\providers\print\win\transforms\custom\language\PaperCutIn\PaperCutOut.tranform

  16. 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.

  17. If you navigate to the
    [install-path]\providers\print\win\transforms\logs
    you should find a .log, .before and .after file. 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 %%BeginSetup and HardDisk).


Categories: How-to Articles , Print Jobs


Keywords: PDL Transform , Global Print Driver , Cross-vendor Printing

Comments

Last updated March 15, 2024