Solved

I have problems getting Acrobat PDF programmatically getting the filename to print the PDF using the register.

Posted on 2014-10-20
2
17 Views
Last Modified: 2016-06-22
I need help with getting Acrobat to bypass the save dialog for filenames in order to programmatically add the filename and continue printing using the Windows registry.  I have been reading in distiller manual and Q&A sites that this would work.    I did get filenames listed in the registry sometimes, but nothing happened.  Most of the time I
get  my document path only and untitled.pdf as the filename.  Once I got the filename only with no path.  Here is some code attached below...


Open in new window

void CMainFV::SetAdobeRegistryPrint()
{
      CHPCCiDBApp *pTheApp = (CHPCCiDBApp *)AfxGetApp();

        LPCTSTR lpValueName;
      CONST BYTE *lpData;
      DWORD cbData;

//      HKEY hkey; // defined in mainfv.h

      if (RegOpenKey(HKEY_CURRENT_USER,_T("Software\\Adobe\\Acrobat Distiller\\PrinterJobControl"),&hkey) != ERROR_SUCCESS)    // (handle to open key,,  subkeys to open, handle address to open key
      {
                  AfxMessageBox("Unable to open registry key!", MB_OK);
                  return;
      }

      if (pTheApp->OS_ProcessorType == 64)
      {
         lpValueName = "LastPdfPortFolder - splwow64.exe";
        // lpValueName = "40cd65f0";

      }
      else  // 32
      {

            AfxMessageBox("just a check!", MB_OK);
                        

      }

      
      if (RegSetValueEx(hkey, lpValueName, 0, REG_SZ,  (LPBYTE) "C:\\Users\\JOHNM\\Documents\\FUNZ.pdf",  strlen("C:\\Users\\JOHNM\\Documents\\FUNZ.pdf") * sizeof(char)) != ERROR_SUCCESS)
      {
            RegCloseKey(hkey);
            AfxMessageBox("Unable to set registry value name!", MB_OK);
      }
      else
            AfxMessageBox("Registry value name set!", MB_OK);




}
0
Comment
Question by:John Morrison
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
sarabande earned 500 total points
ID: 40393870
why not calling ShellExecute with "print" option?

if acrobat was associated to .pdf print, you would call

ShellExecute(NULL, _T("print"),  strPathToFile, NULL, NULL, SW_HIDE);

Open in new window

where strPathToFile should be a full qualified path to the pdf file to print.

if another printer for .pdf is associated (type "assoc .pdf" in a command window) you could try

ShellExecute(NULL, _T("print"),  strPathToAcrobatExe, strPathToFile, NULL, SW_HIDE);

Open in new window

which would invoke acrobat and pass the filename as first argument.

Sara
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Starting up a Project

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question