What tools/methods are available to build pcl stream from PDFs.
We have a bunch of generated PDF files that get tied up into one big pdf. I need to generate a print job to print this with the ability to insert pcl escape sequences (to control paper feed and output bin stacking) per page. As of now we use the VB.Net printing classes, convert the PDF into a rasterized image using a third party tool to print. This does not allow us to insert PCL sequences into the print job.
So, basically, we need to process a bunch of PDFs, append them to the pcl and insert PCL commands as we go along. Is there a way to achieve this. Our application is written in VB.Net.
Any suggestions are greatly appreciated.
PCL and PDF are completly different languages, you cannot insert one into the other. If I had all the details I might recommend something different; however, based on what you have described I'd suggest converting the PDF documents to PCL using Ghostscript (using the ljet4 or other PCL output 'device' it includes) and then you can append/prepend any PCL commands data you need to control trays etc. Keep in mind that you probably won't be able to simply insert tray selections at the top, you'll need to move to an appropiate spot in the PCL stream and do this such as, after the E.
The one major downfall with this is that the PCL that Ghostscript creates is basically one large graphic per page so it's not effecient at all and doesn't provide you the ability to search in the PCL for text etc.
Things you haven't provided detail that might help recommend something more speicific include:
Other options you could use include:
EDIT: Adding further detail based on a discussion with innocentDev
Sorry for the late updated response, looks like you've sorted it out on your end.
If the end result is to take a PDF file and convert to something print printer understands while inserting tray selection commands at know spots then I think there are 2 solutions. You could do this as a conversion to PCL or Postscript. Postscript may be easier for the fact that PCL uses a FF (formfeed) control code to break each page and the FF character might appear throughout the page during a font declaration and/or graphic image.
If you do manage the break the document on the FF by splitting pages out of the individually or doing some extra work to determine that the FF is actually a page break and not one of the other instances of the character, or even finding some other element that you can break on (Ghostscript may have some other code at the start of each page that is consistent, I'm not 100% sure). Another way is to break the document into pages using Ghostscript or even pdftk, convert each page to PCL, insert the commands and concatenate the pages together; however, based on my previous comments regarding convert from PDF to PCL you might end up with a very large output file. This shouldn't impact print performance of the device but may slow data transmission etc.
If you go the PCL route, once you have it converted you simply need to add the appropriate PCL command for tray selection to each page in the document at the start of each page.
<esc>&lxH where x is the tray number.
There are some standards for this; however, devices with more than 3 trays often don't follow these standards and they've change a little over time as HP renumber things when they decided to remap the multipurpose tray from a multipurpose feeder to tray 1. Check your devices documentation or install their PCL print driver and print to file to the tray you want it to output to and you can see what number they use.
If you go Postscript you can do the same but breaking the pages may be easier as you can split the doucment (or at least look for) commands such as this:
%%Page: x x
%%BeginPageSetup
These always appear in Postscript output from Ghostscript. Once you find them you can insert a Postscript MediaSource command during the page setup and accomplish the same thing. You could even use the Postscript commands for media type or media colour. There are some generic commands for this but you might need to use something specific for the device you are outputting to. You can always review the device documentation, their PPD file or, what I often do, is print to file something from their driver and look at how they implement the coding.