#150811 - 2005-10-31 04:46 PM
Problems converting VBS to KiX...
|
masken
MM club member
   
Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
|
Need some help guys. Never really learned how to convert VBS's to KiX Anyone who can give a clue? This is the VBS example: Code:
' $Id: hello.vbs,v 1.11 2004/05/23 11:25:51 tm Exp $ ' ' PDFlib client: hello example for COM with Windows Script Host and VBS ' Requires the PDFlib COM component ' Option Explicit
Dim font Dim oPDF
Set oPDF = WScript.CreateObject("PDFlib_com.PDF")
if (oPDF.begin_document("hello.pdf", "") = -1) then WScript.Echo "Error: " & oPDF.get_errmsg WScript.Quit(1) end if
oPDF.set_info "Creator", "hello.vbs" oPDF.set_info "Author", "Thomas Merz" oPDF.set_info "Title", "Hello, world (COM/WSH)!"
oPDF.begin_page_ext 595, 842, ""
font = oPDF.load_font("Helvetica-Bold", "unicode", "")
oPDF.setfont font, 24
oPDF.set_text_pos 50, 700 oPDF.show "Hello, world!" oPDF.continue_text "(says COM/VBS)"
oPDF.end_page_ext "" oPDF.end_document ""
Set oPDF = Nothing
..and this is my failing attempt in KiX: Code:
$oPDF = CREATEOBJECT("PDFlib_com.PDF") IF @ERROR ? "ERROR creating object: @ERROR (@SERROR)" EXIT 1 ENDIF
IF $oPDF.begin_document("hello.pdf", "") = -1 ? "ERROR: " + $oPDF.get_errmsg EXIT 1 ENDIF
$oPDF.set_info = "Creator", "hello.vbs" $oPDF.set_info = "Author", "Thomas Merz" $oPDF.set_info = "Title", "Hello, world (COM/WSH)!"
$oPDF.begin_page_ext = 595, 842, ""
$font = $oPDF.load_font("Helvetica-Bold", "unicode", "")
$oPDF.setfont = $font, 24
$oPDF.set_text_pos = 50, 700 $oPDF.show = "Hello, world!" $oPDF.continue_text = "(says COM/VBS)"
$oPDF.end_page_ext = "" $oPDF.end_document = ""
_________________________
The tart is out there
|
Top
|
|
|
|
#150812 - 2005-10-31 05:06 PM
Re: Problems converting VBS to KiX...
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Here's my quick stab at it... totally untested ...
Code:
break on
Dim $font Dim $oPDF
$oPDF = CreateObject("PDFlib_com.PDF")
if $oPDF.begin_document("hello.pdf", "") = -1 ? "Error: " + $oPDF.get_errmsg Quit(1) endif
$oPDF.set_info("Creator", "hello.vbs") $oPDF.set_info("Author", "Thomas Merz") $oPDF.set_info("Title", "Hello, world (COM/WSH)!")
$= $oPDF.begin_page_ext(595, 842, "")
$font = $oPDF.load_font("Helvetica-Bold", "unicode", "")
$oPDF.setfont($font, 24)
$oPDF.set_text_pos(50, 700) $oPDF.show("Hello, world!") $oPDF.continue_text("(says COM/VBS)")
$oPDF.end_page_ext("") $oPDF.end_document("")
$oPDF = 0
exit 0
|
Top
|
|
|
|
#150820 - 2005-11-01 04:30 AM
Re: Problems converting VBS to KiX...
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11625
Loc: CA
|
Not a COM object, but still a nice deal for creating PDF files without having to buy the full Acrobat product or similar programs. You can't edit them, but just about anything you can print, you can create a PDF. It uses the Ghost Writer tool from many years ago.
$FREE PDF printer driver http://www.primopdf.com/
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 323 anonymous users online.
|
|
|