Converting a doc to pdf using (or not) a pdf pritner

I need to add the doc to pdf feature in my application. I mostly have doc or rtf files, I just want to convert them to pdf to use them as e-mail attachments.

by searching "vcl doc to pdf" or "delphi doc to pdf" on google is a nightmare: just ads-websites.

So I am trying another way. By assuming the user installs a pdf printer (like the free winpdf writer) I ask him to set the desired pritner for printing pdfs.

So I tried with

procedure PrintDocument(const documentToPrint : string) ;
var
  printCommand : string;
  printerInfo : string;
  Device, Driver, Port: array[0..255] of Char;
  hDeviceMode: THandle;
begin
        printCommand := 'printto';
    Printer.PrinterIndex := PDFPRINTERINDEX; // PDFPRINTERINDEX is set to the pdf printer chosen by the user
    Printer.GetPrinter(Device, Driver, Port, hDeviceMode) ;
    printerInfo := Format('"%s" "%s" "%s"', [Device, Driver, Port]) ;
   ShellExecute(Application.Handle, PChar(printCommand), PChar(documentToPrint), PChar(printerInfo), nil, SW_HIDE) ;
end;

This is ok for printing with winpdf, but this opens a save to dialog. I would instead programmatically set the destination filename and not open the file after generation.

Another trick coulf be use a commandline converter. Like DocToPdf.exe... But who knows and used one of those?

Alternative (and prefered) is a VCL component. Anyway I was not able to find a suitable Doc to Pdf native VCL component.

May anyone help me?

Thanks.
0
Francesco
2/12/2010 10:49:22 AM
embarcadero.delphi.non-tech 5933 articles. 1 followers. Follow

10 Replies
1577 Views

Similar Articles

[PageSpeed] 38

Native VCL component that converts rtf, doc (Word 2003 and previous), docx (Word 2007 and greater) would be the best for me! (open office writer also, but not important)

Edited by: Francesco Faleschini on Feb 12, 2010 2:56 AM
0
Francesco
2/12/2010 10:56:54 AM
As a general purpose solution you might look at this - It is really designed to give programs producing Dot Matrix output a new lease of life
      
http://dosprint.freetzi.com

It can create PDFs/ RTFs/ or talk to any valid Windows printer
You can have it sitting in the system tray and monitor for the appearance of files matching a mask you provide or use a command line to convert single files as you wish.
Adding a jpg / bmp watermark and numerous other options are supported.

NOTE : You must produce an input file which uses the Epson EscP command set - which may be more trouble than you want to go to in this context. ?

(I have always found Bojan Banko, the author,to be very helpful and responsive to questions)

Best regards
0
Harry
2/12/2010 11:16:07 AM
> {quote:title=Harry Rogers wrote:}{quote}
> As a general purpose solution you might look at this - It is really designed to give programs producing Dot Matrix output a new lease of life
>       
> http://dosprint.freetzi.com
> 
> It can create PDFs/ RTFs/ or talk to any valid Windows printer
> You can have it sitting in the system tray and monitor for the appearance of files matching a mask you provide or use a command line to convert single files as you wish.
> Adding a jpg / bmp watermark and numerous other options are supported.
> 
> NOTE : You must produce an input file which uses the Epson EscP command set - which may be more trouble than you want to go to in this context. ?
> 
> (I have always found Bojan Banko, the author,to be very helpful and responsive to questions)
> 
> Best regards

Thanks, but too extreeme and time consuming to investigate. Moreover i am scared by something called "dos" in 2010.
0
Francesco
2/12/2010 11:19:08 AM
Sorry to post so much but i mean:

a RAD way to convert a doc to pdf....

there are doctopdf.exe commandline tools, but with those I would have security warnings and problems with Vista and Seven.

a non visual VCL component for a quite required task: converting a doc to pdf with a RAD tool!
0
Francesco
2/12/2010 11:58:02 AM
Francesco Faleschini schrieb:
> I need to add the doc to pdf feature in my application. I mostly have doc or rtf files, I just want to convert them to pdf to use them as e-mail attachments.
> 

There is a quite good product from neevia.com to create pdfs. They
install a  generic pdf printer on the system which can easily be
accessed and configured.

If you like a "non printer solution" I suggest you use wpdf
(www.wpcubed.com) - a
pdf tool which can also be used in a printer like manner but
does not install one (the only drawback is that if you need
to create high res pdf's it's an advantage to have printer installed
since the tool uses the printers reference dc to paint on).

kind regards
    Mike
0
Michael
2/12/2010 1:48:39 PM
How about these guys

http://www.scalabium.com/

They have components for reading .doc files natively without ole or a need to have Word installed.
Also Export to PDF amongst other things.

Best of luck
0
Harry
2/12/2010 2:49:45 PM
I use PDF995 which has an API (sort of).

Andrew

Francesco Faleschini wrote:
> I need to add the doc to pdf feature in my application. I mostly have doc or rtf files, I just want to convert them to pdf to use them as e-mail attachments.
> 
> by searching "vcl doc to pdf" or "delphi doc to pdf" on google is a nightmare: just ads-websites.
> 
> So I am trying another way. By assuming the user installs a pdf printer (like the free winpdf writer) I ask him to set the desired pritner for printing pdfs.
> 
> So I tried with
> 
> procedure PrintDocument(const documentToPrint : string) ;
> var
>   printCommand : string;
>   printerInfo : string;
>   Device, Driver, Port: array[0..255] of Char;
>   hDeviceMode: THandle;
> begin
>         printCommand := 'printto';
>     Printer.PrinterIndex := PDFPRINTERINDEX; // PDFPRINTERINDEX is set to the pdf printer chosen by the user
>     Printer.GetPrinter(Device, Driver, Port, hDeviceMode) ;
>     printerInfo := Format('"%s" "%s" "%s"', [Device, Driver, Port]) ;
>    ShellExecute(Application.Handle, PChar(printCommand), PChar(documentToPrint), PChar(printerInfo), nil, SW_HIDE) ;
> end;
> 
> This is ok for printing with winpdf, but this opens a save to dialog. I would instead programmatically set the destination filename and not open the file after generation.
> 
> Another trick coulf be use a commandline converter. Like DocToPdf.exe... But who knows and used one of those?
> 
> Alternative (and prefered) is a VCL component. Anyway I was not able to find a suitable Doc to Pdf native VCL component.
> 
> May anyone help me?
> 
> Thanks.

-- 
Andrew Gabb
email: agabb@tpgi.com.au       Adelaide, South Australia
phone: +61 8 8342-1021
-----
0
Andrew
2/14/2010 2:47:40 AM
> {quote:title=Harry Rogers wrote:}{quote}
> How about these guys
> 
> http://www.scalabium.com/
> 
> They have components for reading .doc files natively without ole or a need to have Word installed.
> Also Export to PDF amongst other things.
> 
> Best of luck

I checked. They only export to txt not to pdf.
0
Francesco
2/15/2010 11:36:45 AM
Hi Francesco,
I do similar things with Novapdf(.com) - SDK. It's a 
pdf-printer-driver, well done (can produce PDF/A, too; very important 
for Italian pubblic adminstrations), with events when finishing the 
printing so you can handle the file (e-mail or what else).
best regards
Toni Santa
sabesoft.it


Il 12/02/2010, Francesco Faleschini ha detto :
> I need to add the doc to pdf feature in my application. I mostly have doc 
> or rtf files, I just want to convert them to pdf to use them as e-mail 
> attachments.
>
> by searching "vcl doc to pdf" or "delphi doc to pdf" on google is a 
> nightmare: just ads-websites.
>
> So I am trying another way. By assuming the user installs a pdf printer 
> (like the free winpdf writer) I ask him to set the desired pritner for 
> printing pdfs.
>
> So I tried with
>
> procedure PrintDocument(const documentToPrint : string) ;
> var
>   printCommand : string;
>   printerInfo : string;
>   Device, Driver, Port: array[0..255] of Char;
>   hDeviceMode: THandle;
> begin
>         printCommand := 'printto';
>     Printer.PrinterIndex := PDFPRINTERINDEX; // PDFPRINTERINDEX is set to 
> the pdf printer chosen by the user     Printer.GetPrinter(Device, Driver, 
> Port, hDeviceMode) ;     printerInfo := Format('"%s" "%s" "%s"', [Device, 
> Driver, Port]) ;    ShellExecute(Application.Handle, PChar(printCommand), 
> PChar(documentToPrint), PChar(printerInfo), nil, SW_HIDE) ; end;
>
> This is ok for printing with winpdf, but this opens a save to dialog. I 
> would instead programmatically set the destination filename and not open 
> the file after generation.
>
> Another trick coulf be use a commandline converter. Like DocToPdf.exe... 
> But who knows and used one of those?
>
> Alternative (and prefered) is a VCL component. Anyway I was not able to 
> find a suitable Doc to Pdf native VCL component.
>
> May anyone help me?
>
> Thanks.
0
Toni
2/16/2010 10:11:07 AM
Francesco Faleschini wrote:
> I need to add the doc to pdf feature in my application. I mostly have doc or rtf files, I just want to convert them to pdf to use them as e-mail attachments.
> 
> by searching "vcl doc to pdf" or "delphi doc to pdf" on google is a nightmare: just ads-websites.
> 
> So I am trying another way. By assuming the user installs a pdf printer (like the free winpdf writer) I ask him to set the desired pritner for printing pdfs.
> 
> So I tried with
> 
> procedure PrintDocument(const documentToPrint : string) ;
> var
>   printCommand : string;
>   printerInfo : string;
>   Device, Driver, Port: array[0..255] of Char;
>   hDeviceMode: THandle;
> begin
>         printCommand := 'printto';
>     Printer.PrinterIndex := PDFPRINTERINDEX; // PDFPRINTERINDEX is set to the pdf printer chosen by the user
>     Printer.GetPrinter(Device, Driver, Port, hDeviceMode) ;
>     printerInfo := Format('"%s" "%s" "%s"', [Device, Driver, Port]) ;
>    ShellExecute(Application.Handle, PChar(printCommand), PChar(documentToPrint), PChar(printerInfo), nil, SW_HIDE) ;
> end;
> 
> This is ok for printing with winpdf, but this opens a save to dialog. I would instead programmatically set the destination filename and not open the file after generation.
> 
> Another trick coulf be use a commandline converter. Like DocToPdf.exe... But who knows and used one of those?
> 
> Alternative (and prefered) is a VCL component. Anyway I was not able to find a suitable Doc to Pdf native VCL component.
> 
> May anyone help me?
> 
> Thanks.

Give PDF Creator a try. It is an open source solution. It uses GS in 
background for capturing and converting output PDF.

Of course like others it installs a Printer Driver. Printing to this 
driver will generate PDF files.

You will be able to benefit in other way also it is open source by 
studying its code.

Check it: http://sourceforge.net/projects/pdfcreator

HTH
0
Yogi
2/18/2010 4:42:47 AM
Reply:

Similar Artilces:

freepdf2doc.com - The Most Accurate PDF-to-Word Converter
Name: Ropomitlydili Email: avoigojaimbataimdotcom Product: eBay Companion Summary: freepdf2doc.com - The Most Accurate PDF-to-Word Converter - pdf to doc converter Comments: <B>freepdf2doc.com</B> Using our PDF-to-Word conversion technology, you can quickly and easily create editable DOC/RTF files, making it a cinch to re-use PDF content in applications like Microsoft Word, Excel, OpenOffice, and WordPerfect. Best of all, it's entirely free! <a href=http://freepdf2doc.com><B>convert pdf to doc</B></a> From URL: http://en-GB.www.mozill...

how to convert dynamicaly loading images to pdf using HTML to PDF Converter for .NET
how to convert dynamicaly loading images to pdf using HTML to PDF Converter for .NET Now am converting using how to convert dynamicaly loading images to pdf using HTML to PDF Converter for .NET  tool. But the dynamicaly loading images are not showing in the pdf .     Are you using 3rd party tool or you are using iTextSharp free utility? If it is 3rd party tool, it's always suggested to ask the company which built the tool. Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti Hi vishnusekhar, As to convert images/douments ...

How do I convert HTML document into PDF/Doc/PPT In Asp.Net without using third party tools. Using DotNet1.1.
How do I convert HTML document into PDF/Doc/PPT In Asp.Net without using third party tools. Using DotNet1.1. Note: Html document contains VML shapes, Css, and javascript. Hi,Check this  http://www.codeproject.com/aspnet/HTML2PDF.asp http://www.colorpilot.com/pdfsample_aspnet.html http://www.pdfonline.com/ http://www.codeproject.com/csharp/SERTF2PDF.asp http://www.codeproject.com/csharp/convertdocintootherformat.asp?df=100&forumid=25071&exp=0&select=1541741  Mehedi HasanMark as answer if the post meets your requirement! H...

problems in converting doc to pdf using itextsharps
Hi friends,i need help for this problem.......i am having a doc document and want to convert into pdf and i have come to a situation where my code is not passing any error but it is not converting doc to pdf properly.....my solution is like this........1)Get the doc file and convert it into html........2)Save that html and parse it in pdf using htmlparser of itextsharp.Now my code is working properly for doc to html and also the file is saved in to html but here is i am having problem....problem1)I dont know how to dispose COM resources.problem2)After running the html to pdf code when i open...

Problem with converting .doc file to .pdf file and also filling it with some details using iTextSharp
Hello Mate,                     I am having a problem in converting a .doc file in to .pdf file using iTextSharp.dll .And also i would like to wirte some details in to the form. the problem is the conversion of .doc to .pdf file is not working and also filling in to the converted .pdf file is also not working.Could you please tell me a solution?   This is my code  in this below method i am passing the full path of an existing .doc file public void Convert_And_Fill(string filepath...

Convert Gridview Data in to PDf file. or Convert report data in pdf file
 Hi have problem to convert Gridview data into PDF file..let me know is there any solution or open source components..Regards Rambhopal Reddy EPlease remember to click “Mark as Answer” on the post that helps you, and to click “Unmark asAnswer” if a marked post does not actually answer your question. Friend, Check this thread for soultions http://forums.asp.net/t/1164793.aspx and then to http://www.aspnetworld.com/articles/2004011801.aspx   Good luck!     Please Don't forget to click "Mark as Answer" on the post that helped you.This can be benef...

Writing to a PDF file or using PDF in RDLC using VWD 2005 Express
I've looked all over this forum to know how to write to a PDF file without any success. What I want to do is have the user press a button or click a link and a form/application will print out with the fields filled in from the SQL Server Express database. The form/application is a PDF file (some have edit fields some don't). I need a way to fill in this form/application using data from the database already. I've looked at some third party packages without understanding how they work. I've tried to place the PDF file on the rdlc form (or convert it) so it generates like a report witho...

Amyuni PDF Creator or PDF Converter
Which Amyuni should one use Amyuni PDF Creator or PDF Converter to print to PDF? ---== Posted via the PFCGuide Web Newsreader ==--- http://www.pfcguide.com/_newsgroups/group_list.asp We use PDF Converter.... "egattu" <egattu@yahoo.com> wrote in message news:LuJ7Sa67BHA.258@forums.sybase.com... > Which Amyuni should one use > Amyuni PDF Creator or PDF Converter to print to PDF? > > ---== Posted via the PFCGuide Web Newsreader ==--- > http://www.pfcguide.com/_newsgroups/group_list.asp we use AMYUNI PDF Creator for various things. It works g...

how do i convert .doc to .pdf ????
hi i have using asp.net,c# 2005 ,sql server actullay i have upload some MS document  in to my project folder then i have to convert that doc file to pdf am struggling on this part 1.i dont know how can i convert doc to pdf ?????????????? 2.after created pdf file i have to attached in email  to send a particular  member ....... anybody ..... please let me know this post.its a  bit  urgent Vino Hi1. This tutorial may be helpful for u to convert doc to pdf.http://www.verypdf.com/pdfcamp/doc2pdf_readme.html  2. Sending attached emails:http://www.st...

PDF To DOC Converting
Hello, I'm trying to take tables, lines and other formatting from a PDF file and edit them in a word document. So far I can only capture the text or import them as graphic images, which I can't modify (add\remove text) Anyhow, any ideas would be appreciated. Thanks DH You might try this site. There may be some useful info there. http://www.pdfzone.com/ "Hermit" <valnare@hotmail.com> wrote in message news:b45vbj$243m$1@news.grc.com... > Hello, I'm trying to take tables, lines and other formatting from a PDF file > and edit them in a word...

Convert DOC to PDF
Hey all, I have an application in which users browse for the MS Word file (doc) on their local drive and upload it to our server. I need to convert it to PDF before its stored on the server. Is there built-in support in ASP.NET to do something like this? Any ideas how this could be accomplished? Thanks! you'll need a third-party tool to do that, here's one of them for example. http://www.activepdf.comAsk and it will be given to you; seek and you will find; knock and the door will be opened to you. Luke 11:9 hi, There is no direct built-in support to convert to pdf format. ...

Converting .doc to .pdf
I need to convert an existing .doc file into .pdf and .html files inside my asp.net 2.0/VS2005 application. I have Adobe PDF printer installed, but don't know how to call it from VB.NET code. http://pcwin.com/Business___Finance/Word_Processing/CZ_doc2pdf_COM/index.htm   check this link i hope it helpsMurali KrishnaIT DepartmentBrooke Corporation________________________________________________Remember to click on Mark as answer on the post that helped you------------------------------------------------ Hi,These might be helpful  http://www.pdfonline.com/ htt...

How to convert doc to pdf
 Hi all,My requirement is to retrieve the doc file (VAR BINARY DATA) from database & convert it into pdf, and display the same in web page. Here my doubt is, if my system does not have MS Office or OpenOffice, then how to do this, Can anyone suggest me an idea..Thanks in advance.. Check out this post: http://forums.asp.net/t/1168683.aspx Hanan Schwartzberg--------------------http://www.lionsden.co.il...

Convert .doc to .pdf
Does anyone know how I can convert a .doc file to a .pdf using vb.net.  I want the user to click a link that corresponds to a file and the file is then converted to a pdf.  You could use from DocConverter from ActivePDF. Website Design Darlington - http://mdssolutions.co.ukhttp://lessthandot.com - Experts, Information, Ideas & Knowledgehttp://aspnetlibrary.com - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer" on this post if it helped you Hi, Had ur problem ressolved.If u find a solution please reply.I had a s...

Web resources about - Converting a doc to pdf using (or not) a pdf pritner - embarcadero.delphi.non-tech

Facebook Begins Converting Users To HTTPS
Are you willing to sacrifice a little bit of speed for a lot more safety? Facebook is asking that very question with its announcement that it ...

Facebook No Longer Converting Groups Into Pages
Back when Facebook first launched Facebook Pages, many businesses and brands who had built up substantial audiences in their Facebook Groups ...

Vert - simply converting for iPhone, iPad, and iPod touch on the iTunes App Store
Get Vert - simply converting on the App Store. See screenshots and ratings, and read customer reviews.

Converting SIM Card to Micro SIM Card - Flickr - Photo Sharing!
Place new Micro SIM into the iPhone SIM card tray

Ayaan Hirsi Ali on Converting Muslims to Christianity - YouTube
Complete video at: http://fora.tv/2010/07/29/Nomad_From_Islam_to_America_with_Ayaan_Hirsi_Ali Ayaan Hirsi Ali explains her support of missionary ...

Click go fears of converting print files
Is there a way to convert a print queue item to a .RTF or .PDF file? I like to save or email them. - The Sydney Morning Herald

Sudanese woman ordered to hang under sharia law for converting to Christianity gives birth
Khartoum, Sudan: A Christian Sudanese woman sentenced to hang for apostasy has given birth in jail, a Western diplomat said on Tuesday.

Imams warn against radicalism to Aboriginal inmates converting to Islam
The prison system has enlisted the help of ASIO to crack down on radicalisation behind bars amid revelations that Aboriginals are converting ...

Converting the world's companies one by one - The Science Show - ABC Radio National (Australian Broadcasting ...
Image: Trucks carrying logs make their way up a road in Jambi, Indonesia. A vast area of the Sumatran forest, and orangutan habitat, is being ...

Converting Churches Into Homes Is The Latest Hollywood Trend
You don't have to be a believer to be moved by the beauty of a church.

Resources last updated: 11/25/2015 6:05:43 AM