-
1. Re: PRINTING WITH VB6 OR JavaScript
lrosenth Aug 23, 2010 1:55 PM (in response to NonLinearly)Are you working with Adobe Acrobat or Adobe Reader? What version?
The SDK contains many examples, though perhaps not what you are looking for.
Tray selection is not part of the PDF standard nor supported by Acrobat/Reader, except in an "automatic" mode (select tray based on page size). Any tray selection will need to be by your software controlling the printer directly. It may also require you to "split" the PDF and send multiple jobs. (of course, Reader doesn't support splitting - only Acrobat).
You also need to be aware of the EULA for Acrobat & Reader and how they can NOT be used in a server environment.
-
2. Re: PRINTING WITH VB6 OR JavaScript
NonLinearly Aug 25, 2010 4:22 AM (in response to lrosenth)Thanks for your reply...
I have acrobat pro 8...
First let's start with simple things..
Could someone show me an example how can I print programmatically a range of specific pages from a pdf document?
Let's say that we have a FileName.pdf on C:/FileName.pdf, the printer has the name PrinterName and we want to print pages 5 to 7...
The code must be in visual basic 6 or/and in acrobat javascript...most things SDK describes them with very very complicated way...And in some cases there is nothing to say...
About the tray selection I can handle it with creation of two printers... one with tray 1 as the defaulf tray and the second with tray 2...
But could you send me a code example how can I do tray selection with pagesize? What do you mean? Have to go to the printer and set one tray with A4 and the second tray with other pagesize? But I want A4 in both. How can then I determine the pagesize in code?
And something else... I did not find "many examples" about this in the SDK 9.1 that I downloaded (for free) from the adobe's site...You are referring to something else...This SDK is horrible...
All I need is a simple print and it seems that for acrobat this is big project!!! I beleave that there is a way but there is luck of documentation...
Thanks anyway...
-
3. Re: PRINTING WITH VB6 OR JavaScript
lrosenth Aug 25, 2010 5:16 AM (in response to NonLinearly)The most flexible option will be the this.printPages() API for JavaScript. There are some good examples of how to use that (and the associated printParams object) in the SDK documentation.
You can call that from VB using the JSObject, and there is VB sample code for working with the JSObject in the SDK.
If the page sizes are the same - so that's not the reason for tray swap - then the built-in feature won't help.
There is only one SDK - it has sample code, HTML-based documentation and more for the MANY parts of Acrobat. You want to focus on the IAC (Interapplication Communication) section, which is what VB is about.
-
4. Re: PRINTING WITH VB6 OR JavaScript
ReinhardF Aug 25, 2010 2:13 PM (in response to lrosenth)Hi,
attached a vbs for hidden printing via js object.
It may give you a start up.
HTH, Reinhard
PrtHidden.vbs
--------------------------------------------
fileIn = "C:\Test.pdf" '' state the full path of the file to open
set App = CreateObject("AcroExch.App") '' start Adobe Acrobat
App.Show '' show Acrobat or comment out for hidden modeset AVDoc = CreateObject("AcroExch.AVDoc") '' connect to Ac Viewer
AVDoc.Open fileIn,"" '' Open a file into viewer
set PDDoc = AVDoc.GetPDDoc '' Get the Doc opened in the viewer
set JSO = PDDoc.GetJSObject '' Connect to Acrobat JS
JSO.app.alert("Hi, file is open.Press Ok for printing") '' Display a MsgBox
'JSO.print("bUI","nStart","nEnd","bSilent","bShrinkToFit",..)
nEnd=jso.numPages-1 ''nEnd zeroBase
JSO.print False,0,nEnd,False,True '' print with some options
JSO.closeDoc(True)App.CloseAllDocs '' close all docs
App.exit -
5. Re: PRINTING WITH VB6 OR JavaScript
NonLinearly Aug 27, 2010 2:05 AM (in response to ReinhardF)ReinhardF, thanks for your reply, it was helpful but I didn't see where the printer is determined? If there is not such option the code is useless because I need to change the printer according to a flag that is dynamically obtained through an iteration from a connection to a database table.
If this code print to the default printer then can I alternately change the default printer using windows API?
Thanks...
-
6. Re: PRINTING WITH VB6 OR JavaScript
lrosenth Aug 27, 2010 5:32 AM (in response to NonLinearly)You can set the printer via the printParams object.
Have you read the documentation on that object yet?
-
7. Re: PRINTING WITH VB6 OR JavaScript
ReinhardF Aug 27, 2010 12:28 PM (in response to NonLinearly)Hi,
have a look at the printParams you can find in AcroJs help at: http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.ht m?&accessible=true
The IAC JSO presents the doc/this js object.
Attached the example, which prints to a specific printer using the printParams.
HTH, Reinhard
PrintToNamedPrinter.vbs
'--------------------------------------------
fileIn = "C:\Test.pdf" '' state the full path of the file to open
set App = CreateObject("AcroExch.App") '' start Adobe Acrobat
App.Show '' show Acrobat or comment out for hidden modeset AVDoc = CreateObject("AcroExch.AVDoc") '' connect to Ac Viewer
AVDoc.Open fileIn,"" '' Open a file into viewer
set PDDoc = AVDoc.GetPDDoc '' Get the Doc opened in the viewer
set JSO = PDDoc.GetJSObject '' Connect to Acrobat JS
JSO.app.alert("Hi, file is open.Press Ok for printing") '' Display a MsgBox'//JSO.print("bUI","nStart","nEnd","bSilent","bShrinkToFit","bPrintAsImage","bReverse","bA nnot","bprintParams")
endPage = jso.numPages-1 ''nEnd zeroBased
set pp = JSO.getPrintParams() ''contact print parameters
pp.printerName = "Kyocera FS-1700+" ''set a printername
JSO.print False,0,endPage,False,True,False,False,True,pp '' print with some optionsJSO.closeDoc(True) '' close the printed doc
App.CloseAllDocs '' - or /and - close all docs
App.exit -
8. Re: PRINTING WITH VB6 OR JavaScript
mikecj517 Jan 20, 2011 1:28 PM (in response to ReinhardF)Everyone,
Please forgive for hijacking the original post. The code is great but I'm having one issue with it.
At the line > jso.Print False, 0, nEnd, False, True '' print with some options
I get Run Time Error 438 Object doesn't support this property or method. Is there a specific reference I need to allow the jso.print (or pddoc.print) to occur.
Any thoughts on a possible solution.
Thanks,
MikeCJ
-
9. Re: PRINTING WITH VB6 OR JavaScript
lrosenth Jan 20, 2011 2:52 PM (in response to mikecj517)What version of Acrobat do you have installed? (and you need Acrobat and not Reader)
-
10. Re: PRINTING WITH VB6 OR JavaScript
NonLinearly Jan 22, 2011 3:31 AM (in response to NonLinearly)The case is closed... The acrobat pro does not have the ability to print with dynamic tray selection! Even if I make a second instance of the printer to print alternately then there is a problem... some times pages that print to second instance printer preciding pages that print to first instance and the output does not has the right order...
-
11. Re: PRINTING WITH VB6 OR JavaScript
mikecj517 Jan 24, 2011 4:54 AM (in response to lrosenth)Lrosenth,
I apologize for not replying through the forum but I could not find the reply button.
In response to your question, Adobe Acrobat 7.0 Professional.
Michael Cochran
EH&S Manager
L-3 Communications Display Systems
1355 Bluegrass Lakes Parkway
Alpharetta, GA 30004
Phone: 770-752-5468
Fax: 770-752-5481
-
12. Re: PRINTING WITH VB6 OR JavaScript
lrosenth Jan 24, 2011 6:18 AM (in response to mikecj517)Unfortunately, we no longer support Acrobat 7.



