Solved

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

Posted on 2014-10-20
2
15 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Identify two keyboard codes and how to enter them 9 84
printf performancy 11 102
Programming Codes 2 68
Cannot locate cell 15 41
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

732 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