After trying as many possibilities as I can without successful result, here is my question regarding with iTextsharp component.
I have a requirement on creating a ticket for which I decided to use the iTextSharp Library.
I have used this library on java & .net projects with fixed length documents without problems but in this case document is variable length. The document is created perfectly and accordingly with the spec. After the PDF is created I use System.Diagnostics.Process with the verb “PrintTo” for send it to the printer. Due to the variable length nature of the ticket it is not adequate to set a fixed paper length on the printer, so I use the following line to instruct the printer to take the document size (accordingly with Manning iText in Action 2nd Edition, page 140) but it seem not to function properly.
writer.AddViewerPreference(PdfName.PICKTRAYBYPDFSIZE, new PdfBoolean(true));
Any ideas on how could I send the document to printer instructing the printer to adjust the paper size to the document size?
Thanks in advance,
By using
GhostScript(GHS) andmswinpr2as printing device we were able to print to practically any printer recognized for the Operative System (Windows).To stablish the paper size it is necesary to set the following arguments when invoking GHS command line utility (gswin32c):