Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing other pdf doc from another 1

Status
Not open for further replies.

kienna

Technical User
May 15, 2003
16
CA
Hi,

I am trying to get 3 documents to print when I click on one button from a seperate form. I have tried doing this with a button and javascript. However, using this.print does not work as it is only printing the form that I am starting with.

If anyone could help me out that would be great!

Thanks!
 
You need to open the document first.

var firstDoc = app.openDoc("first.pdf", this);
first.print({bUI: false, nStart: 0, nEnd: 6, bSilent: false, bShrinkToFit: true, bPrintAsImage: false, bReverse: false, bAnnotations: false});
firstDoc.closeDoc();


Change the variable names, filenames and attributes as required - descriptions of what the attributes do can be found in the JavaScript guide.

I seem to recall I only got it to work by having a separate MouseUp JavaScript for each document to print - so you'd need three MouseUp JavaScripts for yours e.g. First, Second and Third.

Also, you need to ensure that the documents you are printing have a document-level JavaScript:

this.disclosed = true

otherwise they won't be recognised by the JavaScript in your original form.

Note: I have not tried this with Acrobat(or Reader) 6, so it might not work. Also, it may not work in Acrobat (or Reader) 4.

 
I tried typing that into my javascript. Where you have firstDoc I had wi106 typed in as that was what my file is called. where you had first, I also typed in wi106. However, I get an error telling me that wi106 is not a function.

I also do not understand what the this.disclosed = true means or where to put it.

Thanks for your help.
 
What version are you using?

There's actually a mistake in the code I put above (sorry). Here's what it should be with your document name (hopefully - difficult to know for sure without seeing the document):

var wi106Doc = app.openDoc("wi106.pdf", this);
wi106Doc.print({bUI: false, nStart: 0, nEnd: 6, bSilent: false, bShrinkToFit: true, bPrintAsImage: false, bReverse: false, bAnnotations: false});
wi106Doc.closeDoc();

The nStart and nEnd numbers are the first page and last page of the range you want to print - replace them with the range you actually want to print, page 1 = 0, page 2 = 1, etc.

If you're using version 5 then, in the documents that you need to print, go to Tools>JavaScript>Document JavaScripts. Type:

disclosed

then click Add

Delete the code that already appears in the window and replace it with:

this.disclosed=true;

Click OK. Click Close and save the document.

This should work. If not, would you be able post the document with the button in and the sample document somewhere, then I could see if I can see what's not working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top