Jump to content

Recommended Posts

Posted

I have hit another road block. I am trying to print a pdf from a GUI. Problem is that because the ACRO dll is so buggy, I am using the IE control. I would like to print the pdf once it is viewed. Her is what I have to load the control:

$AcroPDF = ObjCreate("Shell.Explorer.2")

$AcroPDF_ctrl = GUIctrlcreateobj($AcroPDF, 336, 24, 457, 561)

$AcroPDF.Navigate(@ScriptDir & "\readme.pdf#toolbar=0&navpanes=0&scrollbar=1&zoom=45")

So my preview window looks perfect, but now I would like to add a button to print.

Any ideas?

Posted

1) For people to look down the list and say "I think I can help this guy" name your subject something related to your question please, this also helps for future learners that hit a "Road Block" to be able to use the search to find what they are looking for.

2) Here is a code that I use in one of my scripts to pull up the print dialog and print a section of my GUI.

$pos = WinGetPos($title)
        $hbmp = _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image2.jpg",$pos[0] + 5 + $width-(($height-50)*(5/6)+25),$pos[1] + 30 + 25,$pos[0] + ($width-(($height-50)*(5/6)+25)) + ($height-50)*(5/6),$pos[1] + 25 + 25 + $height-50,False)
        _ScreenCapture_SaveImage (@MyDocumentsDir & "\GDIPlus_Image2.jpg", $hBmp)
        $sPrintFile = @MyDocumentsDir & "\GDIPlus_Image2.jpg"
        Run('Rundll32.exe "' & @SystemDir & '\mshtml.dll",PrintHTML "' & $sPrintFile & '"', @SystemDir)
        WinWaitActive("Print")
        FileDelete(@MyDocumentsDir & "\GDIPlus_Image2.jpg")

Good luck in your learning

Giggity

Posted

Thanks, I gave that a try, but it only prints a blank page. Here is what I have:

Run('Rundll32.exe "' & @SystemDir & '\mshtml.dll",PrintHTML "' & "c:\doc.pdf" & '"', @SystemDir)

Posted (edited)

I am using XP SP3, Adobe Reader 9, The file does exists and prints fine using the _FilePrint() function. The problem with that function is that it doesn't allow you to select the printer and it opens an adobe reader instance and leaves it open minimized at the bottom.

**Also, I just tried it with a text file and it work perfect. It has to be related to the Adobe Reader

Edited by Gut

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...