CutePDF command line or equivilant
Simple solution
If the output path doesn't matter, you could try PDFCreator with the following commandline:
C:\Program Files (x86)\PDFCreator>PDFCreator.exe /NOSTART /PF"C:\test.doc"
- Per GUI you have to enable Use Auto-save and set a auto-save path once.
From now on, this path will be used every time you execute the command above - You have to set PDFCreator as your default printer
Tip:
Per GUI you can save your settings in a profile (.INI file) which can then be selected when you execute your command line. This way, you don't have to use Auto-save as default for every normal print (e.g. from Word or Excel)
PDFCreator.exe /NoStart /OptionsFile"C:\myprofile.ini" /PF"C:\test.doc"
Advanced solution
The advantage of the second solution is, that you don't have to set PDFCreator as your default printer and you have full control over the output file path and name
Install PDFCreator together with its COM module
-
Copy & paste this code to a textfile and save it as
Convert2PDF.vbs
Set PDFCreator = Wscript.CreateObject("PDFCreator.clsPDFCreator", "PDFCreator_") With PDFCreator ReadyState = 0 .cStart "/NoProcessingAtStartup" .cOption("UseAutosave") = 1 .cOption("UseAutosaveDirectory") = 1 .cOption("AutosaveFormat") = 0 .cOption("AutosaveStartStandardProgram") = 0 DefaultPrinter = .cDefaultprinter .cDefaultprinter = "PDFCreator" .cClearcache .cPrinterStop = false .cOption("AutosaveDirectory") = WScript.Arguments(1) .cOption("AutosaveFilename") = WScript.Arguments(2) .cPrintfile cStr(WScript.Arguments(0)) c = 0 Do While (ReadyState = 0) and (c < 120) c = c + 1 Wscript.Sleep 250 Loop .cDefaultprinter = DefaultPrinter .cClearcache WScript.Sleep 200 .cClose End With Public Sub PDFCreator_eReady() ReadyState = 1 End Sub
You can execute your VBScript file from the command line with this syntax:
Convert2PDF.vbs "C:\input.doc" "C:\outputfolder" "outputfilename"
Personally I use a slightly different version where the input and output folder+filename stays the same. I created a shortcut in my shell:sendto
folder to easily convert files per right-click
Related videos on Youtube
Ash King
Updated on September 18, 2022Comments
-
Ash King almost 2 years
I have build my database ofcourse etc but I have problem with the code.I try to solve that "Names of marines(one time each one) that have for reservation red boat and their have tonnage bigger than 200." and I did that.
Select distinct m.name From marina m join reservation r on (m.mid, r.mid) Where r.bid = (select b.bid from boat b where b.color = "red")
I tryed use that https://senseful.github.io/text-table/ but I failed so I post here if someone can help edited.That is my database.
drop table if exists reservation; drop table if exists marina; drop table if exists boat; drop table if exists sailor; create table boat (bid integer not null constraint c_bid primary key, bname varchar(40), color varchar(40) constraint c_color check (color in ('Red','Blue','Light Green','Yellow'))); create table marina (mid integer not null constraint m_key primary key, name varchar(40) not null, capacity integer); create table sailor (sid integer not null constraint c_sid primary key, sname varchar(40), rating integer constraint c_rating check (rating between 1 and 10), age real constraint c_age check (age < 18 OR age = 18)); create table reservation (sid integer not null constraint f_key1 references sailor(sid) on delete cascade, bid integer not null constraint f_key2 references boat(bid) on delete restrict constraint c_bid check (bid not in (999)), mid integer constraint f_key3 references marina(mid) on delete set null, r_date date not null constraint c_date check (r_date > '02/04/1998'), constraint p_key primary key(sid,bid,r_date)); INSERT INTO sailor(sid,sname,rating,age) VALUES (2, 'John', 6, 17); INSERT INTO sailor(sid,sname,rating,age) VALUES (11, 'Mary', 10, 18); INSERT INTO sailor(sid,sname,rating,age) VALUES (12, 'TH', 7, 14); INSERT INTO sailor(sid,sname,rating,age) VALUES (13, 'John', 9, 18); INSERT INTO sailor(sid,sname,rating,age) VALUES (1, 'Christin', 10, 17); INSERT INTO sailor(sid,sname,rating,age) VALUES (15, 'Thod', 10, 13); INSERT INTO sailor(sid,sname,rating,age) VALUES (16, 'Leonid', 5, 13); INSERT INTO sailor(sid,sname,age) VALUES (17,'Left',17); INSERT INTO sailor(sid,sname,rating,age) VALUES (19,'Polu',1,16); INSERT INTO sailor(sid,sname,rating,age) VALUES (27,'Marinin',8,15); INSERT INTO sailor(sid,sname,rating,age) VALUES (37,'Cos',8,14); INSERT INTO marina(mid,name,capacity) VALUES(33,'Porto',300); INSERT INTO marina(mid,name,capacity) VALUES(5,'Calam',105); INSERT INTO marina(mid,name,capacity) VALUES(1,'Plat',32); INSERT INTO marina(mid,name,capacity) VALUES(7,'Pos',19); INSERT INTO marina(mid,name,capacity) VALUES(2,'Our',105); INSERT INTO boat(bid,bname,color) VALUES(88,'Sof','Blue'); INSERT INTO boat(bid,bname,color) VALUES(17,'Ag','Light Green'); INSERT INTO boat(bid,bname,color) VALUES(13,'Panag','Yellow'); INSERT INTO boat(bid,bname,color) VALUES(1,'Αg.N','Red'); INSERT INTO boat(bid,bname,color) VALUES(72,'Christin','Red'); INSERT INTO boat(bid,bname,color) VALUES(19,'Dil','Light Green'); INSERT INTO boat(bid,bname,color) VALUES(77,'Αg.G','Blue'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(2,88,7,'1999-02-17'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(12,17,2,'1998-05-17'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(11,17,2,'1999-01-17'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(13,13,7,'2003-01-13'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(11,13,33,'2000-05-05'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(1,1,33,'2000-05-05'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(1,13,33,'2000-05-06'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(1,17,33,'2000-05-07'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(1,19,33,'2000-05-08'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(1,72,33,'2000-05-09'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(1,88,33,'2000-05-10'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(1,77,2,'2000-08-10'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(19,13,33,'1999-10-12'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(27,88,7,'2000-06-11'); INSERT INTO reservation(sid,bid,mid,r_date) VALUES(37,72,2,'2001-04-27');
-
daxlerod almost 11 yearsWhat kind of files are they? The program used to display, edit, and print the file will determine what terminal command should be used, if the command exists at all.
-
SuperSafie almost 11 yearswhat error message do you get?
-
nixda almost 11 yearsDo you need a specific output path or could it be the same path as the input path is? For example
print C:\test.doc
would create a new PDF file underC:
-
Ash King almost 11 yearsThe path doesn't really matter, would prefer it to be the same as the input but that can be changed accordingly, the error im getting is: "Unable to initialize device CPW2" Although in printers this is the correct port. Im not sure whether its something to do with cutepdf itself
-
nixda almost 11 years@AshKing Hello, I would be pleased if you could leave some feedback to know if I have to improve my answer.
-
a_horse_with_no_name about 4 yearsPlease edit your question (by clicking on the edit link below it) and add some sample data and the expected output based on that data as formatted text. See here for some tips on how to create nice looking text tables. (edit your question - do not post code or additional information in comments)
-
Admin about 4 years@a_horse_with_no_name I didn't manage it to edited as you want.I post the code to the site but nothing.
-
Admin about 4 yearsI don't know ..it asks me also and bigger than 200 and that I didn't put it too
-
-
Admin almost 11 yearsI just tried your advanced method and nothing happened, but then again I'm trying to convert a .ppt to a .pdf
-
nixda almost 11 years@OWiz Can you provide more details what you exactly have done?
-
nixda over 7 yearsI'm not sure if this solution is still viable. PdfForge released a new major version and their documentation changed
-
Arun Palanisamy about 4 yearsWhat is your expected output?