?
Solved

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

Posted on 2014-10-20
2
Medium Priority
?
27 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 35

Accepted Solution

by:
sarabande earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes
Suggested Courses

771 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