HTML/URL link to pdf converter

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
amein
Posts: 5
Joined: 06 Nov 2015, 03:09

HTML/URL link to pdf converter

06 Nov 2015, 03:16

Hey guys, this is my new account for this forum, i dont know why my id from previous forum cannot use to login.

So, regarding the topic, I want to convert links to pdf. I read few sample from previous forum and provide link below.. anyone have any idea that code from link below still working? i tried, but cant get it work. Please help.. :)

http://autohotkey.com/board/topic/87965 ... y-folders/

http://autohotkey.com/board/topic/34839 ... -in-batch/

http://autohotkey.com/board/topic/63736 ... com-ahk-l/

Sample code...

Code: Select all

; Batch-convert htm(l) to PDF
;
; uses [color=red]PDFCreator[/color] (http://www.pdfforge.org/products/pdfcreator)
;
; First: [color=red]set in PDFCreator in Options -> Auto-save[/color] (options and directory for output)
;
; Uses [color=red]COM.ahk[/color] by Sean (http://www.autohotkey.com/forum/topic22923.html)
;

urlsToConvert =
(LTrim Join`,
http://www.google.com
http://www.yahoo.com
http://www.autohotkey.com
)

oldPrinter := GetDefaultPrinter()
SetDefaultPrinter("PDFCreator")

COM_AtlAxWinInit() 
Gui, +LastFound +Resize 
pwb := COM_AtlAxGetControl(COM_AtlAxCreateContainer(WinExist(),0,0,510,600, "Shell.Explorer") ) 
Gui, Show, w510 h600 ,Gui Browser 

Loop, Parse, urlsToConvert, CSV
{
  COM_Invoke(pwb, "Navigate", A_LoopField) 
  loop 
        If (rdy:=COM_Invoke(pwb,"readyState") = 4) 
           break
  COM_Invoke(pwb, "ExecWB", 6, 2)
  Sleep 5000 ; could not get GetPrinterStatus info, so uses sleep instead
}

SetDefaultPrinter(oldPrinter)

Gui, Destroy 
COM_AtlAxWinTerm() 
ExitApp

GetDefaultPrinter()
   {
         nSize := VarSetCapacity(gPrinter, 256)
         DllCall(A_WinDir . "\system\winspool.drv\GetDefaultPrinterA", "str", gPrinter, "UintP", nSize)
         Return gprinter
   }

SetDefaultPrinter(sPrinter)
   {
      DllCall(A_WinDir . "\system\winspool.drv\SetDefaultPrinterA", "str", sPrinter)
   }
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: HTML/URL link to pdf converter

06 Nov 2015, 03:36

If you downloaded the new PDFCreator:
NOTE:
The COM Interface was completely redesigned for PDFCreator 2.0, any code written for PDFCreator <= 1.7.3 will need to be replaced in order to work with the new interface.
The new PDFCreator COM interface still has beta status.
http://docs.pdfforge.org/pdfcreator/lat ... interface/

Also AHK 1.1+ supports COM natively.

HTH
amein
Posts: 5
Joined: 06 Nov 2015, 03:09

Re: HTML/URL link to pdf converter

06 Nov 2015, 04:00

Xtra wrote:If you downloaded the new PDFCreator:
NOTE:
The COM Interface was completely redesigned for PDFCreator 2.0, any code written for PDFCreator <= 1.7.3 will need to be replaced in order to work with the new interface.
The new PDFCreator COM interface still has beta status.
http://docs.pdfforge.org/pdfcreator/lat ... interface/

Also AHK 1.1+ supports COM natively.

HTH
I see.. maybe temporary i can try download v1.7.3 and try run again. thank you..
amein
Posts: 5
Joined: 06 Nov 2015, 03:09

Re: HTML/URL link to pdf converter

06 Nov 2015, 05:25

easier way... im using this

http://wkhtmltopdf.org/

thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 194 guests