Jump to content

HTML to PDF


Recommended Posts

I'm pretty sure you can do that whith gs(ghostscript). Don't ask me how.

I would rather use PDFCreator or PaperlessPrinter (I think they use gs as a backend). Those tools are just virtual printers that can convert every printable "thing" into pdf(image,...)-format. If you want to do that with autoit, I would suggest you search the web how you could do that with these trio. :P

Edited by dabus
Link to comment
Share on other sites

Is it possible to convert html file tO Pdf with autoit ?

are there available functions for autoit ?

any free command line tool ?

Thanks !

Have you tried searching on google?

I have and I found this:

http://www.freedownloadscenter.com/Web_Aut...s/html2pdf.html

I suggest picking up the

Google Hacks Book (O'Reilly)

isbn 0-596-00857-0

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Link to comment
Share on other sites

Or you could pay $99 to get the Adobe SDK, and really put AutoIt to work to convert an HTML document to PDF.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

No, I don't have a script. Basically would involve printing your document from the app of your choice (in this case, your web browser). I'm not sure much is to be gained by scripting it, unless you need to batch convert a number of documents.

BlueBearrOddly enough, this is what I do for fun.
Link to comment
Share on other sites

  • 7 years later...

maybe this can help. at any issue, please post you error message.

Func Htmltopdf($your_fullpath_HTML_file)
Const $maxTime = 10 ; in seconds
Const $sleepTime = 250 ; in milliseconds


Dim $fso, $WshShell, $PDFCreator, $DefaultPrinter, $ReadyState, $c, $Scriptname, $Scriptbasename, $URL
$URL = StringReplace( "file:///" & StringReplace($your_fullpath_HTML_file,"\","/"), " " , "%20")


$fso = ObjCreate("Scripting.FileSystemObject")
$WshShell = ObjCreate("WScript.Shell")

$PDFCreator = ObjCreate("PDFCreator.clsPDFCreator")
if IsObj($PDFCreator) then
ProgressSet(20, "creación de objetos ")
Else
    msgbox(48, "SACLIS - Impresión PDF","No se puede crear Objeto PDF!")

EndIf

$PDFCreator.cStart ("/NoProcessingAtStartup")
$ReadyState = 0

With $PDFCreator
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = @ScriptDir  & "\test"
.cOption("AutosaveFilename") = "html_" & $DNI
.cOption("AutosaveFormat") = 0 ; 0=PDF, 1=PNG, 2=JPG, 3=BMP, 4=PCX, 5=TIFF, 6=PS, 7= EPS, 8=ASCII
 $DefaultPrinter = .cDefaultprinter
.cDefaultprinter = "PDFCreator"
.cClearcache()  ;$helpstring = StringReplace(@Desktopdir,"\","/")
.cPrintURL($URL,250)
.cPrinterStop = 0
EndWith
ProgressOff()
$c = 0

Do
$c = $c + 1
    Sleep ($sleepTime)
Until ($ReadyState = 0) and ($c < ($maxTime * 1000 / $sleepTime))

With $PDFCreator
.cDefaultprinter = $DefaultPrinter
    Sleep(200)
.cClose()
EndWith

If $ReadyState = 0 then
Consolewrite ("Creating test page as pdf." & @CRLF & @CRLF & "An error is occured: Time is up!"& @CR)
ProcessClose("PDFCreator.exe")

EndIf

EndFunc

:robot:

Pionner

Edited by pionner
Link to comment
Share on other sites

  • Moderators

pionner,

You do realise that the post above yours is 8 years old? In future please engage your brain before hittng the "Submit" button. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...