How to set output filename to docPrint PDF Driver Virtual Printer?

Hello,

I'm using the docPrint PDF Driver as a virtual printer from a console application. I am setting the PrinterSettings.PrintToFile to true and setting the PrinterSettings.PrintFileName. Is there a way to set the output file type to .tif without displaying the SaveAs window. If I use pdfconfiggui.exe to set the Auto Save and Output Type it ignores the PrinterSettings.PrintFileName.

Thank you for your time,
Customer
---------------------------------------------------

image
Please download Document Printer SDK (docPrint SDK) from this web page,

http://www.verypdf.com/app/document-converter/try-and-buy.html#buy_sdk
http://www.verypdf.com/artprint/docPrint-sdk.zip

docPrint-sdk.zip contains the details about how to set the output filename before printing.

You can call SetOutputFileName() function to set the output filename to docPrint PDF Driver before you print a document to it, for example,

SetOutputFileName("D:\\verypdf-out.tif");

BOOL GetConfigFilePath(char *lpszDesktopPrograms, int length)
{
    HKEY hCU;   
    DWORD dwType;   
    ULONG ulSize = MAX_PATH;
    HKEY hrkey = HKEY_CURRENT_USER;

    memset(lpszDesktopPrograms, 0, length);
    hrkey = HKEY_LOCAL_MACHINE;
    if (RegOpenKeyEx(hrkey, "SOFTWARE\\verypdf\\docprint",
        0, KEY_QUERY_VALUE, &hCU) == ERROR_SUCCESS)
    {
        RegQueryValueEx(hCU,       
            //"Personal",
            "ConfigFile",
            NULL,       
            &dwType,
            (unsigned char *)lpszDesktopPrograms,       
            &ulSize);     
        RegCloseKey(hCU);   
    }
    else
        return FALSE;
    return TRUE;
}
void InitialIniFileName(char *lpszIniFilename)
{
    GetConfigFilePath(lpszIniFilename, MAX_PATH);
}
void SetOutputFileName(const char *lpszOutputFile)
{
    if(lpszOutputFile == NULL || lpszOutputFile[0] == 0)
        return;

    char szIniFilename[300];
    InitialIniFileName(szIniFilename);
    //Set the output filename to docPrint
    WritePrivateProfileString("AutoSave", "IsAutoSave", "1", szIniFilename);
    WritePrivateProfileString("AutoSave", "OutputFile", lpszOutputFile, szIniFilename);
    WritePrivateProfileString("AutoSaveOptions", "m_bCreateFileForEachPage", "1", szIniFilename);
    WritePrivateProfileString("AutoSaveOptions", "m_strColorDepth", "24", szIniFilename);
    WritePrivateProfileString("AutoSaveOptions", "m_strResolution", "400x400", szIniFilename);
    WritePrivateProfileString("AutoSaveOptions", "m_bGrayscale", "0", szIniFilename);
    //Use run length compression arithmetic for TIFF file
    WritePrivateProfileString("AutoSaveOptions",".tif","-compress rle",szIniFilename);   
}

VeryPDF

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

Related Posts

This entry was posted in docPrint Pro and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!