PostScript to PDF Converter

A C++ example to convert Postscript files to PDF files simultaneously

This is a VC++ source code example, this example does call ps2pdf.exe in a multiple threads and convert more PS files to PDF files concurrently,

 

#include <stdio.h>

#include <tchar.h>

#include <windows.h>

 

DWORD WINAPI PS2PDF_Thread(LPVOID lpParameter)

{

    int threadNum = (int)lpParameter;

 

    printf("Thread %d started\n", threadNum);

 

    PROCESS_INFORMATION pi = {0};

    char commandLine[4096] = {0};

    char threadNumStr[16] = {0};

   

    STARTUPINFO StartupInfo = {0};

    StartupInfo.cb = sizeof(STARTUPINFO);

    StartupInfo.dwFlags = STARTF_USESHOWWINDOW;

    StartupInfo.wShowWindow = SW_HIDE;

 

    _itoa(threadNum, threadNumStr, 10);

 

    strcpy(commandLine, "ps2pdf.exe -debug");

    strcat(commandLine, " \"pdftest");

    strcat(commandLine, threadNumStr);

    strcat(commandLine, ".ps\"");

 

    printf("Thread %d process starting %S\n", threadNum, commandLine);

 

    BOOL cpSuccess = CreateProcess(NULL, commandLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &StartupInfo, &pi);

   

    if (cpSuccess == FALSE)

    {

        printf("Thread %d process failed to start\n", threadNum);

    }

 

    printf("Thread %d process started\n", threadNum);

 

    DWORD waitResult = WaitForSingleObject(pi.hProcess, INFINITE);

   

    printf("Thread %d process finished\n", threadNum);

 

    if (waitResult != WAIT_OBJECT_0)

    {

        printf("Thread %d process wait = %d\n", threadNum, waitResult);

    }

 

    if (pi.hProcess != NULL)

    {

        CloseHandle (pi.hProcess);

        pi.hProcess = NULL;

    }

 

    if (pi.hThread != NULL)

    {

        CloseHandle (pi.hThread);

        pi.hThread = NULL;

    }

 

    printf("Thread %d finished\n", threadNum);

 

    return 0;

}

 

int _tmain(int argc, _TCHAR* argv[])

{

    int numThreads = 10;

    HANDLE* hThread = NULL;

 

    printf("Running %d threads\n", numThreads);

 

    for (int i = 0; i < numThreads; i++)

    {

        wchar_t pdfFileName[32] = {0};

        wchar_t threadNumStr[16] = {0};

 

        _itow(0, threadNumStr, 10);

 

        wcscpy(pdfFileName, L"pdftest");

        wcscat(pdfFileName, threadNumStr);

        wcscat(pdfFileName, L".pdf");

 

        DeleteFileW(pdfFileName);

    }

 

    hThread = new HANDLE[numThreads];

 

    for (i = 0; i < numThreads; i++)

    {

        hThread[i] = ::CreateThread(NULL, 0, PS2PDF_Thread, (LPVOID)i, CREATE_SUSPENDED, NULL);

    }

 

    for (int j = 0; j < numThreads; j++)

    {

        ResumeThread(hThread[j]);

    }

 

    WaitForMultipleObjects(numThreads, hThread, TRUE, INFINITE);

 

    if (hThread != NULL)

    {

        delete []hThread;

        hThread = NULL;

    }

   

    printf("Press [Enter] to exit.\n");

    getchar();

 

    return 0;

}

 

 

VN:F [1.9.20_1166]
Rating: 8.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: -1 (from 1 vote)
DOC to Any Converter

How to convert Text files to TIFF files?

Is there a reference guide for the command line of Doc2Any? I recently purchased a license for one of our servers to do batch conversion of TXT to TIFF, but there seems to be an error in the conversion, as the files are coming across as garbage and the conversion shows ERROR. I would like to see what the error is and verify i am doing the TIFF conversion correctly.

Customer
------------------------------------
Yes, you can use doc2any to convert text files to TIFF files, please look at following web page for more information,

https://www.verydoc.com/blog/convert-text-to-tiff-and-compress-tiff-by-ccitt-method-through-command-line.html

In general, you can run following command lines to convert text files to TIFF files easily,

doc2any.exe -useprinter -compression 4 "C:\in.txt" C:\out.tif
doc2any.exe -compression 4 "C:\in.txt" C:\out.tif
doc2any.exe -useprinter -compression 4 "C:\in.txt" C:\out.tif
doc2any.exe -multipagetif -useprinter -compression 4 "C:\in.txt" C:\out.tif

If you can't get it work, please feel free to let us know what command line that you used, we will assist you asap.

VeryDOC

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
HTMLPrint to Any Converter

Print HTML file (or URL) to PDF file and put a header text on every PDF page, Website to PDF Conversion with dynamic text contents on page header and page footer areas

I have the need to put a header on every page of a PDF that I am creating from an HTML file. I was hoping to use the tag as Internet Explorer uses.

Used your -default-header tag but got a "Result is failed. No output" error message. Am I missing something?

Also, in your readme.txt file, there is a -custom-header.

Can you tell me what names and values are allowed?

Thanks for your help.
Customer
--------------------------------------------------------------
Did some more searching on your knowledge base and found this:

https://www.verydoc.com/blog/can-i-add-page-number-to-pdf-footer-using-html2any-command-line.html

I didn't know -hfflag, -header and -footer were available since it's not in your documentation (or I couldn't find it).

Put this in but still getting the same error message. Help!

Here is my command line:

html2any -hfflag on -header "&w" "https://www.verydoc.com" "C:\mypdf.pdf"

If I remove the -hfflag and -header, it works fine. I also tried -default-header and that doesn't seem to work as well.

Thanks for your time.
Customer
--------------------------------------------------------------

image
No, your command line is wrong, please run following command line to try again,

html2any -hfflag on -header "&w" -printtopdf "D:\temp\mypdf.pdf" "https://www.verydoc.com"

OR

html2any -hfflag on -footer "&w" -printtopdf "D:\temp\mypdf.pdf" "https://www.verydoc.com"

If you want print HTML file to PDF file, you need use "-printtopdf" option to specify the output PDF filename, please notice this matter.

VeryDOC

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
DOC to Any Converter

useoffice and nooffice options in doc2any.exe application. How can doc2any.exe to determine MS Office, OpenOffice and without Office automatically?

Thank you - you have been extremely helpful!

Question: I have one last question. If an office suite is installed, will doc2any prefer the
office suite for the conversion, or it will default to the internal converter without office suite.

As doc2any has a command line option to prefer one or the other conversion (useoffice=1 or 0), I am wandering which one should be the preferred one, or whether doc2any will take care of this i.e. if office is installed it will use office conversion, otherwise it will use it's own conversion routine. I'm hoping it will be the last case, as then I do not have to worry about ever passing a 'useoffice' command line options.

If you could clarify this, I would be most thankful.

Customer
----------------------------------------------------------
>>Question: I have one last question. If an office suite is installed, will >>doc2any prefer the office suite for the conversion, or it will default to the >>internal converter without office suite.

Please add "-nooffice" option to stop doc2any.exe using the office installed in your system, e.g.,

doc2any.exe -nooffice D:\test.doc D:\out.pdf

>>As doc2any has a command line option to prefer one or the other conversion (useoffice=1 or 0), I am wandering which one should be the preferred one, or whether doc2any will take care of this i.e. if office is installed it will use office conversion, otherwise it will use it's own conversion routine. I'm hoping it will be the last case, as then I do not have to worry about ever passing a 'useoffice' command line options.
If you could clarify this, I would be most thankful.

If you want doc2any.exe to forget the Office suite completely, please use "-nooffice" parameter,

doc2any.exe -nooffice "C:\test.doc" "C:\out.pdf"
doc2any.exe -nooffice "C:\test.docx" "C:\out.pdf"
doc2any.exe -nooffice "C:\test.xls" "C:\out.pdf"
doc2any.exe -nooffice "C:\test.xlsx" "C:\out.pdf"
doc2any.exe -nooffice "C:\test.ppt" "C:\out.pdf"
doc2any.exe -nooffice "C:\test.pptx" "C:\out.pdf"
doc2any.exe -nooffice "C:\test.doc" "C:\out.html"
doc2any.exe -nooffice "C:\test.docx" "C:\out.html"
doc2any.exe -nooffice "C:\test.xls" "C:\out.html"
doc2any.exe -nooffice "C:\test.xlsx" "C:\out.html"
doc2any.exe -nooffice "C:\test.ppt" "C:\out.html"
doc2any.exe -nooffice "C:\test.pptx" "C:\out.html"
doc2any.exe -nooffice "C:\test.docx" "C:\out.doc"

If you use "useoffice=1 or 0", MS Office will still be used for some internal conversion. So, "-nooffice" option is the best choose to forget the Office suite.

>>I am wandering which one should be the preferred one, or whether doc2any will take care of this i.e. if office is installed it will use office conversion, otherwise it will use it's own conversion routine.

You can simple forget the "useoffice" option, and run following command line,

doc2any.exe D:\test.doc D:\out.pdf

doc2any.exe will try by following steps,

1. Try to use MS Office to convert this DOC to PDF file, if fails, go to next step,
2. Try to use OpenOffice to convert this DOC to PDF file, if fails, go to next step,
3. Try to use ourself's DOC Render to convert this DOC to PDF file, if fails, print an error message to console,

If you don't use "useoffice" option, doc2any.exe will take care of everything automatically.

VeryDOC

VN:F [1.9.20_1166]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: +1 (from 1 vote)
DOC to Any Converter

Convert RTF, DOC, DOCX to DOC, DOCX, RTF, ODT, HTML, MHTML formats without MS Office and OpenOffice

I'm looking to upgrade my doc2any converter from 2.2.01 to the latest version. I have two questions before I do so:

A: I paid extra for special customization you made last time and need to know that latest version will support:

1. Convert rtf to doc (without office suites)
2. Convert rtf to docx (without office suites)
3. Convert doc to rtf (without office suites)
4. Convert docx to rtf (without office suites)
5. Convert rtf to ODT (without office suites)
6. Convert rtf to HTML (without office suites)
7. Convert rtf to MHT (without office suites)

Please confirm 'exactly' what is and what is not supported from the above list (I do not use MS Office or Open office at all).

Customer
-----------------------------------------------------
>>A: I paid extra for special customization you made last time and need to
>>know that latest version will support:
>>1. Convert rtf to doc (without office suites)
>>Please confirm 'exactly' what is and what is not supported from the
>>above list (I do not use MS Office or Open office at all).

Yes.

>>2. Convert rtf to docx (without office suites)

Yes.

>>3. Convert doc to rtf (without office suites)

Yes.

>>4. Convert docx to rtf (without office suites)

Yes.

>>5. Convert rtf to ODT (without office suites)

Yes.

>>6. Convert rtf to HTML (without office suites)

Yes.

>>7. Convert rtf to MHT (without office suites)

No, it can't create MHTML file without MS Office or OpenOffice installed.

Relevant Hyperlink:

https://www.verydoc.com/blog/verydoc-doc-to-any-converter-command-line-v3-5-release-notes-convert-word-to-pdf-without-office-and-openoffice.html

VeryDOC

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)