Skip to main content
Known Participant
January 30, 2022
Question

Print Button in Adobe to send Fields directly to labels printer for printing using JavaScript

  • January 30, 2022
  • 3 replies
  • 3074 views

Hi Everyone

I have the following request where I want to collect a number of fields in an Adobe doc then compine them in an array so I can compose a list of lables and send it to a sticky lables printer EPSON L90 for printing .

I wrote the following script in a "Print Button" to collect the requested fileds in two arrayes "P_FieldName" & "V_FieldName".


var P_FieldName=[];
var V_FieldName=[];
var pRowStr="";


for (var p=1; p<4; p++) {

      if (p>1) pRowStr="_"+p;

      for (var i=1; i<13; i++) {
             var pField=this.getField("Part NumRow"+i+pRowStr);
            var vField=this.getField("Part VendorRow"+i+pRowStr);
            if (pField != null){
                P_FieldName.push(pField.valueAsString);
                V_FieldName.push(vField.valueAsString);

      }
}

 

Would you please help me with the needed code to compine and send those arrays to the EPSON L90 printer for printing them as lables 

This topic has been closed for replies.

3 replies

try67
Community Expert
Community Expert
February 1, 2022

If you want to print texts what you need to do is create a new (temporary) file, write those texts to it, and then print it, and close it when done. You can also create a template file in advance with the desired layout, open it using a script, fill in the fields in it with the texts, and then print it. All of that will require an advanced, custom-made script, though.

SamKhaMAuthor
Known Participant
February 1, 2022

I have decided to create three pages at the end of the PDF, add a text field is each page, then I will append the field with the fields that the user will fill out. However whenever I try to print the last 3 pages silently and predefine the range of pages to be printed using the following script unfortunatly the print window opens and there is no any predefined rage of pages for printing. Any ideas why this function does not work. Given that I am using Nitro Pro 7.5.0.22


this.print({
bUI: fales,
bSilent: true,
bShrinkToFit: true,
nStart: 4,
nEnd: pr

}); // pr is a variable of the last page to print

try67
Community Expert
Community Expert
February 1, 2022

You misspelled "false" under bUI, but regardless, did you see this note under that method's documentation?

 

Outside of batch, console, and menu events, the values of bUI and of interactive are ignored
and a print dialog box will always be presented.

Legend
January 31, 2022

The key thing is that Acrobat can't print raw or formatted data, it can only print a PDF. So you have to make a PDF. But JavaScript cannot create normal PDF content. It sounds as if filling a form may be your solution.

SamKhaMAuthor
Known Participant
February 1, 2022

If I create a form what if the user selected or filled few fields to print. Is the whole form will be printed. Is there a way where I can control how much of the form need to be printed as I am only printing lables on a lables role printer and I just want to print the filled fields to save lables roles.

try67
Community Expert
Community Expert
February 1, 2022

You can only print entire pages, not parts of pages.

 

Edit: using a script, that is.

Bernd Alheit
Community Expert
Community Expert
January 31, 2022

Have you created a PDF file for the labels?

SamKhaMAuthor
Known Participant
February 1, 2022

No. I am trying to print the string streem from the same PFF

Bernd Alheit
Community Expert
Community Expert
February 1, 2022

This is not possible with a script.