Sign in to follow this  
Followers 0
lukeneo

HTML to PDF

11 posts in this topic

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

are there available functions for autoit ?

any free command line tool ?

Thanks !

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

SciTE has an option to export to PDF, and if it's autoit code, it will keep it's color syntax.

Share this post


Link to post
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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

I like to use one of the free PDF printers to convert any doc to PDF. I use PrimoPDF myself.


BlueBearrOddly enough, this is what I do for fun.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0