3 Replies Latest reply on Jan 25, 2011 10:17 AM by KC1003

    programatic pdf print number of copies

    KC1002

      Hi there,

      I talked with support and they suggested I post the question here so hear goes.

       

      We have a repository of pdf documents that need to be printed from as part of a shipping process. A single pdf document needs to be printed at a time but the quantities could range from 10 to 300 or so. Operators are working in a visual basic application and I have been asked to automatically print the documents as part of the shipping process. This will remove operator error printing 100 when they need 10 or choosing the wrong printer (there are language barriers as well). Suffice to say the automatic print is a valid requirement.

       

      I am having a hard time finding a way to send a single print job with a quantity of copies specified. I have found the /t option for the acrobat reader to print but I don't se an option to specify a quantity. Each example I've found just shows looping calling a single document print as many times as is needed.

       

      The problem is that we have several machines all printing at the same time. One operator starts a print for 100 and another operator starts a print for 100 a few seconds later. Since using acrobat reader /t each operator is actually sending 100 individual print jobs as opposed to a single print job for 100 copies the printer takes the print jobs first come first serve and the resulting paper is a blend of the two print jobs. Like shuffled cards.

       

      If the printer receives a single print job with a quantity specified then the printer will keep each print job separate and that is our goal.

       

      I looked at merging the pdf documents so that a single print would be a single document. Can't do that because the printer sends the documents to a folding machine. Each "copy" of the document needs to be folded individually so a 300 page document isn't the same as 300 copies of a 2 page document.

       

      If we allow the acrobat reader to open and allow the operators to select the destination and quantity then all is well. We just need to do that automatically rather than introduce human error.

       

      There must be some method or tool to do this but so far I have not found any.

      Can anyone point me in the right direction?

      Also I am new to this forum - if I am in the wrong area, let me know and I'll be happy to re-post where it belongs.

      Thanks!

      KC

        • 1. Re: programatic pdf print number of copies
          gkaiseril MVP & Adobe Community Professional

          With Visual Basic you can use Acrobat IAC to access the Acrobat JSO. With the Acrobat JavaScript Object is the 'printParam' which has the 'NumCopies' property that one can use to set the number of copies to print. If you are going to make this a non-interactive script, you will need to create an Acrobat folder level JavaScript to use this feature. You can create a function with the necessary parameters you need to use for printing your documents.

           

          You will find more help on using the Acroat IAC in the Acrobat SDK forum.

          • 2. Re: programatic pdf print number of copies
            KC1002 Level 1

            Hi there!

            Thank you for the reply!

            I will use the JavaScript option if necessary and am heartened to hear that there is a solution.

            The executable currently uses the interop.acropdflib.dll and axinterop.acropdflib.dll components as references and as I say, prints but appears to have no quantity parameter.

            I'll take a look at the SDK. Do you know if Javascript is the only solution for this? I mean within a VB solution referencing an Acrobat DLL I'd think the quantity would be part of any print API - Obviously I was wrong - having to drop to script when already ing using a DLL seems odd? Might there be some other DLL that I should be using instead of what I am already referencing?

            Thanks!

            KC

             

            Sent from my iPhone

            • 3. Re: programatic pdf print number of copies
              KC1003

              Hello there,

              I am KC1002 but logged in under an alternate company credentials.

              I downloaded the SDK and found the sample javascript for silent print. The sample just adds a menu button to the document which is not what I'm looking for but it is a start. Indeed the print works - for a single copy.

              I tried the NumCopies property setting it equal to 3. I get no errors in the javascript console, the document prints but again only one copy.

               

              The folder level script is from Adobe and has a ton of comments that I have removed to shorten the post. Toward the bottom of the script I have inserted the NumCopies=3; but it appears to have no affect.

              I've looked on a variety of forums and it seems others have had this problem as well. It was noted that this option doesn't conform the naming conventions starting with a capital. unfortunately, lower case has no affect either.

               

              It also appears that with just reader on a given machine IAC is not an option. I can make do with adding a folder script to add the button as long as the NumCopies works and I can find a way to automatically click the button (DDE?). I have low hopes on that score since there is some delay between the time the pdf opens and when the button actually shows up.

              I would prefer a folder level script that just prints the document with the desired number of copies and then exits - seemingly much simpler.

               

              Ideas?

              Thanks!

              KC

               

               

              if ( typeof sdkMenuItem == "undefined")

              var sdkMenuItem = false;

               

              if (!sdkMenuItem) {

              sdkMenuItem = true;

              app.addSubMenu( {

              cName:"ACROSDK:JSSubMenu",

              cUser: "Acrobat SDK JavaScript",

              cParent: "Tools",

              nPos: 0

              });

              }

               

              app.addMenuItem( {

              cName: "ACROSDK:SilentPrint",

              cUser: "Silent Print",

              cParent: "ACROSDK:JSSubMenu",

                 cEnable: "event.rc = (event.target != null);",

                 cExec: "JSSilentPrint(event.target)"

              });

               

              trustedPrint = app.trustedFunction(

              function(doc, pparams) {

              app.beginPriv();

              doc.print(pparams);

              app.endPriv();

              }

              );

               

              function JSSilentPrint(theDoc)

              {

              var pp = theDoc.getPrintParams();

               

              pp.interactive = pp.constants.interactionLevel.silent;

              pp.NumCopies = 3;

              var fv = pp.constants.flagValues;

              pp.flags |= fv.setPageSize;

               

              trustedPrint(theDoc, pp);

              }