DOC to Any Converter

How to create PDF from printable files and then send output PDF directly by C#?

Sometime, we need to convert printable files to PDF for printing, long time preserving or others by self-developed applications like ERP.  In this article, I will share a method of creating PDF from printable PDF file and then send output PDF directly by C#. The software I will is named as VeryDOC Doc Converter COM, by which you can convert files of Microsoft Word, PowerPoint, Excel, JPG, PNG, GIF, HTML and others to PDF by script together with other application like VB, VC, C# etc. Please check more detail information on homepage, in the following part, I will show you how to use this software.

Step 1. Free download and install Doc Converter COM

  • Please download and install PDFcamp Printer v2.3 or PDFcamp Printer Pro v2.3, and then download DocConverter COM from our website.
  • Please unzip "doc2pdf_com_trial.zip" package to a folder, and run "install_as_exe.bat" file to install the DocConverter COM into your system
  • Then you can run HTML2PDF.exe from command line to try, HTML2PDF.exe is a Windows Command Line Tool, you can run it from command line window,For example:html2pdf.exe "http://www.yahoo.com" "C:\yahoo.pdf".

Step 2. Create PDF from printable file and then send output PDF by email directly.

  • When you need to call this COM software together with  other applications like C#, please refer to the following command line templates.
  • The following command line template can help you convert .doc, .xls, .html, .txt, .rtf etc files to PDF files, but it will popup a print dialog when conversion, this is a global function, you need set any value before you call it,
    Private Sub Word2PDF_ShellPrint_Click()
        Set PdfCreator = New PDFOUTLib.PdfCreator
        PdfCreator.Word2PDF "C:\sample.doc", "C:\sample.doc.pdf"
        Debug.Print "C:\sample.doc -->C:\sample.doc.pdf"
        MsgBox "Word2PDF_ShellPrint finished"
        Set PdfCreator = Nothing
    End Sub
  • When you need to send output PDF file to some body by email directly, please refer to the following command line templates. After create a PDF file and send it from your mail client, For Example,
            Set PdfCreator = New PDFOUTLib.PdfCreator
            PdfCreator.HTML2PDF = "C:\sample.html"
            PdfCreator.FileName = "C:\sample.pdf"
            PdfCreator.HeadersFooters = "off"
            PdfCreator.paperType = 6 '//7 is A4 paper, 6 is A3 paper
            PdfCreator.subject = "I can control the subject this way"
            PdfCreator.body = "And I can control the body too"
            PdfCreator.SendEmail
            While PdfCreator.StillRunning = 1
                DoEvents
                Call WaitMessage
            Wend
            Set PdfCreator = Nothing

There are too many functions of this software, I can not list all of them here. If you need to know more functions of this software, please visit homepage or User Manual of Doc Converter COM Component. During the using, if you have any question, please contact us as soon as possible.

HTML Converter

How to convert encrypted website to PDF by Doc Converter COM?

   In this article, I will show you how to convert encrypted website to PDF by VeryDOC Doc Converter COM. The encrypted website refers to those websites which have user name and password requited when you need to enter those websites. When converting those website to PDF, you need to specify user name and password first then converting it to PDF. For catering this needs, Doc Converter COM has such function.

What VeryDOC Doc Converter COM is?

VeryDOC Doc Converter COM is a software component which can be used to be integrated with other applications (or DLL Library, or Command Line), enabling developers to access the converter via any programming or scripting languages, such as Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc.

By this software, you can fulfill the following functions:

  • Create PDF from any printable files like web pages and DOC, RTF, TXT, PPT, XLS files into PDF paperwork.
  • After creating PDF, you can send output PDF to others by email directly.
  • Create PDF and specify paper size.
  • When converting HTML to PDF, you can set input document filename or a URL point to a website, set input content from a buffer, this function only can work for a html stream and others.
  • Please check more functions of this software on homepage. In the following part, let us check how to convert encrypted website to PDF briefly.

Convert encrypted website to PDF

  • Free download Doc Converter COM. When downloading finishes, there will be a zip file. Please extract it to some folder then you can find component and help document.
  • When converting encrypted website to PDF, please refer to the following command line template.
    Set username&password for encrypted site to PDF conversion,html2pdf "http://www.xxxxxx.com/index.html" "C:/output.pdf" postdata=Username=support@verypdf.com&Password=password

By the above command line, first you need to input the website URL then the full path of the output PDF file. input user name and password. By this way, you can convert encrypted website to PDF.

Here are more examples of other functions for your reference.

  • Set page header&footer for HTML to PDF conversion,
    "html2pdf.exe" "www.yahoo.com" "C:\yahoo.pdf" "htmlHeaders=this is header,htmlFooters=this is footer"
  • Set values for page header&footer within HTML to PDF conversion,
    "html2pdf.exe" "www.yahoo.com" "C:\yahoo.pdf" "htmlHeaders=&w&bPage &p/&P,htmlFooters=&u&b&d"
  • Set passwords for DOC, DOCX, HTML, MHTML, PPT, PPTX, XLS, XLSX, RTF, etc. document to PDF conversion,
    "html2pdf.exe" "C:/Doc1.DOC" "C:/Doc1.pdf" "Encryption=2,EncryBits=16,Permission=0,UserPass=,OwnerPass=123"
  • Set page margin within conversion,
    "html2pdf.exe" "http://www.yahoo.com" "C:/yahoo.pdf" "paperType=9, pageWidth=575, pageHeight=850, margin_left=10, margin_top=40, margin_right=10, margin_bottom=40"

During the using, if you have any question, please contact us as soon as possible.

HTML Converter

How to convert HTML to PDF together with VC++ code?

       When you need to convert HTML file no matter online or local files to PDF from VC++ code, the following article will be quite helpful for you. Here I will introduce one software named VeryDOC Doc Converter COM, which is a COM object (or DLL Library, or Command Line), enabling developers to access the converter via any programming or scripting languages, such as Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc. The main function of this software is that converting files like Microsoft Word, PowerPoint, Excel, JPG, PNG, GIF, and HTML to PDF and set some limitations. Please get more related information on homepage, in the following part, let us check how to use this software from one example.

Step 1. Free trial of Doc Converter COM

  • All the VeryDOC software is free downloading and trial including the COM version software. But when converting HTML to PDF by this software, please make sure you have the following application installed on your computer:
    PDFcamp V1.8 or newer, or PDFcamp Pro V1.8 or newer and Windows Internet Explorer 5.0 or newer.
  • When downloading finishes, there will be a zip file. You need to extract it to some folder then you can find code template and DLL Library.

Step 2. Convert HTML to PDF from  VC++ code.

  • When you open this software folder then you can find code templates of VB, VC and others. Please run this software according to the template and usage.
  • Here is one example for your reference.
    How do I call DocConverter COM from VC++ code?
    A: Please look at following VC++ function,
                    BOOL ConvertHTMLToPDF (const char *lpHTMLFile, const char* lpPDFFile)
                    {
                            IPdfCreator pdfout;
                            BOOL bRet = pdfout.CreateDispatch(_T("PdfOut.PdfCreator"));
                            if(bRet == FALSE)
                            {
                                    printf("Can't locate 'PdfOut.PdfCreator' in this computer, please reinstall this product to try again.\n");
                                    return FALSE;
                            }
                            pdfout.SetActivePrinter("PDFcamp Printer");
                            pdfout.SetFileName(lpPDFFile);
                            pdfout.SetHtml2PDF(lpHTMLFile);
                            pdfout.SetPaperType(0);
                            pdfout.CreatePDF();
                            while(pdfout.GetStillRunning() == 1)
                            {
                                    MSG msg;
                                    while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
                                    {
                                            TranslateMessage (&msg);
                                            DispatchMessage (&msg);
                                    }
                                    Sleep(20);
                            }
                            pdfout.DetachDispatch();
                            return TRUE;
                    }
    For more information, please read the "readme.txt" file in the "doc2pdf_asp" folder.

Please note when converting HTML to PDF, you need install the MS Internet Explorer 6.0 (MS IE6.0) to convert HTML files to PDF files, the MS IE5.0 and IE5.5 are not enough.  If you need to know more information, please check user manual. During the using, if you have any question, please contact us as soon as possible. 

DOC to Any Converter

How to create PDF from HTML file together with PHP?

   When you need to create PDF from any printable files like MS Word, PowerPoint, Excel, RTF, TXT, image, HTML, etc by some COM version software, software VeryDOC Doc Converter COM is a good choice. This software was developed for developers with some DLL Library, or Command Line, which enables you to call it together with Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc. Please check more information on homepage, in the following part, let us check how to use this software.

Step 1. Download Doc Converter COM

When you use this software, please make sure you have the following software installed in your computer or else the conversion may fail.

  • PDFcamp V1.8 or newer, or PDFcamp Pro V1.8 or newer
  • Microsoft Windows 2000, XP, 2003, Vista, and 7
  • Windows Internet Explorer 5.0 or newer
  • Microsoft Office 97 or newer(when converting Office file to PDF)

When downloading finishes, it is a zip file. Please extract it to some folder then you can call it together with other applications.

Step 2. Create PDF from any printable files.

  • When you use this software, please refer to the usage and templates of this software.
  • Here I will share some code of creating PDF from online website together with PHP application.

How do I call DocConverter COM from PHP code?
A: Some examples for call DocConverter COM Service from PHP code:
Example 1:
                <?php
                        $url = "http://www.verypdf.com";
                        $path = "C:\\test.pdf";
                        $com = new COM("PdfOut.PdfCreator");
                        $com->html2PDF = $url;
                        $com->fileName = $path;
                        $com->Doc2PDFViaSocket();
                ?>
Example 2:
                <?php
                        $PdfCreator =new COM("PdfOut.PdfCreator") or die("Cannot start PdfCreator");
                        $PdfCreator->Doc2PDFCommandLine(' "c:\input.doc" "c:\output.pdf" ');
                        $PdfCreator = null;
                ?>
Example 3:
                <?php
                        $url = "http://www.verypdf.com";
                        $path = "C:\\test.pdf";
                        $com = new COM("PdfOut.PdfCreator");
                        $com->Doc2PDFCommandLine("\"$url\" \"$path\" \"paperType=0,PrintHTMLBackground=yes,overwrite=yes\"");
                ?>

By this software, you can also fulfill the following functions:

  • When creating PDF from HTML file, you can set input document filename or a URL point to a website. You also can set input content from a buffer, this function only can work for a html stream,please notice, you can't use "html2PDF" and "htmlBuffer" in one time.
  • Set page header in the PDF file, it only available when "headersFooters" equal "on".
  • Set page footer in the PDF file, it only available when "headersFooters" equal "on".
  • When creating PDF, you can also specify the page type like the followings:
  • Set page type, the value is from 0 to 9,
        0 "Letter [8.5 x 11 in]",
        1 "Legal [8.5 x 14 in]",
        2 "Executive [7.25 x 10.5 in]",
        3 "Ledger [355.6 x 215.9 mm]",
        4 "Tabloid [11 x 17 in]",
        5 "Screen [10 x 7.5 in]",
        6 "A3 [297 x 420 mm]",
        7 "A4 [210 x 297 mm]",
        8 "A5 [148 x 210 mm]",
        9 Custom page size

There are two many functions and examples of this software, I can not list all of here. During the using, if you have any question, please contact us as soon as possible.

DOC to Any Converter

Failed to call doc2any.exe from Java application to convert PPTX and DOCX files to PDF files

Hi,

I am from XXXXXXXXXX and using verydoc.exe production license.

I got the following log while i was running the very doc command from java application deployed on server.

We run the command from java application as given below,

1. C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug "FILENAME.pptx" "FILENAME.pdf"

2. C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug -runasuser -runaspwd "FILENAME.pptx" "FILENAME.pdf"

with 2nd command we are able to convert the files till 17th July 2013 but unfortunately now it is not working now.

Please find the log below

Check license information...
Thank you for choosing 'VeryDOC DOC to Any Converter' product.
Check utility functions...
Start the conversion...
FILENAME.pptx ==> FILENAME.pdf
Convert PowerPoint document to other formats...
Loading "FILENAME.pptx" file...[20%]
ReportError: PowerPoint could not open the file.
Shutdown PowerPoint Application...[60%]
[FAILED] Failed by SaveAs function in MS PowerPoint application.
Prepare to convert "FILENAME.pptx" file...[10%]
Loading "FILENAME.pptx" file...[20%]
ReportError: PowerPoint could not open the file.
Shutdown PowerPoint Application...[60%]
[FAILED] Can't locate EMF files.
[FAILED] Failed by Render to Metafile function in MS PowerPoint application.
Convert OpenOffice Documents to other formats by OpenOffice: 'FILENAME.pptx'=>'FILENAME.pdf'
[FAILED] Can't retrieve OpenOffice information (shell\open\command) from registry.
[FAILED] OpenOffice does convert this PowerPoint document failed.
Try convert document continue (1)...
Try convert document continue (2)...
Conversion time = 2013ms
FILENAME.pptx ==> FILENAME.pdf, result=ERROR
TickCount = 2013ms(2.01s), Result = 0

Thanks & Regards
Customer
---------------------------------------------------------
Please use full path to try again, can you work fine with full path? for example,

C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug "D:\FILENAME.pptx" "D:\FILENAME.pdf"

VeryDOC
---------------------------------------------------------
Hi,

In my ticket I already mentioned I tried with 2 options given below but no luck. Can you please suggest us to work this command.

1. C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug "FILENAME.pptx" "FILENAME.pdf"

2. C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug -runasuser -runaspwd "FILENAME.pptx" "FILENAME.pdf"

Thanks & Regards

Customer
---------------------------------------------------------
Please use full path for input and output filenames to try again, for example,

C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug "D:\FILENAME.pptx" "D:\FILENAME.pdf"

for example, you can put FILENAME.pptx to D:\ folder, and run above command line to try again.

Can you work fine with full path?

VeryDOC
---------------------------------------------------------
Dear support Team,

With the given command below I can execute in command prompt on the server where verydoc is placed and I can see the output pdf file. My problem is I have deployed my code on server and want to convert office documents to pdf file.

In my commands every time am giving the full path for input and output filenames to convert, here am facing the problem as I mentioned from my first email.

Please let me know if you need more info.

Thanks & Regards

Customer
---------------------------------------------------------
You need set MS Word DCOM run inside an interactive user account instead of default system user account, please look at following web pages for more information,

https://www.verydoc.com/blog/cannot-test-doc2any-on-net.html

Please arrange MS Word DCOM run from an interactive user account, please refer to following web page,

https://www.verydoc.com/doc-to-any-faq.html

"Your COM Name" should equal to "Microsoft Office Word 97 – 2003 Document" in your system, please give enough permission to "Microsoft Office Word 97 – 2003 Document" DCOM in your system to try again.

The following web pages will useful to you too,

https://www.verydoc.com/blog/how-to-call-doc-to-any-converter-sdk-from-asp-net-source-code.html

https://www.verydoc.com/blog/how-to-call-doc2any-exe-from-asp-code.html

http://www.verypdf.com/wordpress/201109/doc2any-sdk-dll-does-work-on-localhost-but-not-work-on-internet-2333.html

https://www.verydoc.com/doc-to-any-shell.html

https://www.verydoc.com/blog/run-doc2any-on-windows-2003-or-windows-2008-system.html

https://www.verydoc.com/blog/how-to-call-doc2any-from-php.html

We have also a VeryPDF Cloud API Platform, this is a Cloud Service to convert online office documents to PDF files, please look at following web pages for more information,

http://www.verypdf.com/online/cloud-api/user-guide.html
http://online.verypdf.com/api/

VeryPDF Cloud API Platform is a cloud service, all conversion will be done on our servers, you needn't install any software to your server in order to convert office documents to PDF files.

VeryDOC