Evaluation Watermark Not Always Removed
Posted: Tue Jun 24, 2014 3:47 pm
We have an application that creates a sequence of PDF files by automating word to create a document and print to a PDF Xchange 4 printer. The majority of documents are correct but there will be the odd few that show the evaluation mode watermark in the top corners. e.g. the current print run I'm looking at contains 68 documents and on the first run document 21 showed the watermark, on the second run all documents were clear and on the third run, documents 17 and 37 showed the evaluation mode watermark.
The application is running on Windows Server 2012 R2.
The version of Word comes from Microsoft Office Professional Plus 2013.
The printer is created using the following code:
#import "progid:PXCComLib.CPXCControlEx" rename_namespace("PXC"), named_guids, exclude("IStream","ISequentialStream","_LARGE_INTEGER","_ULARGE_INTEGER","tagSTATSTG","_FILETIME")
class PDFXCHANGE
{
private:
PXC::IPXCPrinterPtr m_pPrinter;
PXC::IPXCControlExPtr m_pFactory;
_bstr_t m_name;
public:
PDFXCHANGE();
~PDFXCHANGE();
TXD_BOOL init(const TXD_STR *fspec);
const TXD_STR *getname();
TXD_VOID deinit();
};
TXD_BOOL PDFXCHANGE::init(const TXD_STR *fspec)
{
for (;;)
{
if (m_pFactory==NULL)
{
try
{
CLSID clsid;
if (SUCCEEDED(CLSIDFromProgID(L"PXCComLib.CPXCControlEx",&clsid)))
m_pFactory = PXC::IPXCControlExPtr(__uuidof(PXC::CPXCControlEx));
}
catch(_com_error &)
{
continue;
}
catch(...)
{
continue;
}
}
if (m_pFactory==NULL)
return(DXD_BOOL_FALSE);
if (m_pPrinter==NULL)
{
try
{
static WCHAR key[]=L"xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx";
static WCHAR devcode[]=L"PDFX3$Xxxxx$999999_Xxxxxxx#";
m_pPrinter = m_pFactory->Printer[L"", L"PDF-XChange 4.0", key, devcode];
// Diagnostic starts
// Log the key and dev code used for each document
TXD_STR log_fspec[LXI_FSPEC_FSPEC+1]={0};
fxk_sys_get_logs_folder(log_fspec);
if (!fxi_dir_exists(log_fspec))
fxk_sys_makedir(log_fspec);
fxd_str_cat(log_fspec,"PDF\\");
if (!fxi_dir_exists(log_fspec))
fxk_sys_makedir(log_fspec);
TXD_STR filename[LXI_FSPEC_SEG+1]={0};
fxi_fspec_getlseg(fspec,filename);
CXI_LFILE_TIMED file;
file.make(CXD_STR().catf("%str%%str%.TXT",log_fspec,filename).c_str());
file.write(CXD_STR().catf("Key : %wstr%",key).c_str());
file.write(CXD_STR().catf("DevCode: %wstr%",devcode).c_str());
file.close();
// Diagnostic ends
}
catch(_com_error &)
{
deinit();
continue;
}
catch(...)
{
deinit();
continue;
}
}
if (m_pPrinter==NULL)
return(DXD_BOOL_FALSE);
break;
}
m_pPrinter->ResetDefaults();
m_pPrinter->Option[L"Save.SaveType"] = L"Save";
m_pPrinter->Option[L"Save.ShowSaveDialog"] = L"No";
_bstr_t p=fspec;
m_pPrinter->Option[L"Save.File"] = (BSTR)p;
m_pPrinter->Option[L"Save.WhenExists"] = L"Overwrite";
m_pPrinter->Option[L"Save.RunApp"] = FALSE;
m_pPrinter->Option[L"Overlay.Enabled"] = FALSE;
m_pPrinter->Option[L"Compression.Graphics"] = TRUE;
m_pPrinter->Option[L"Compression.Text"] = TRUE;
m_pPrinter->Option[L"Fonts.EmbedAll"] = FALSE;
m_pPrinter->Option[L"Saver.ShowProgress"] = FALSE;
m_pPrinter->ApplyOptions(0);
return(DXD_BOOL_TRUE);
}
const TXD_STR *PDFXCHANGE::getname()
{
m_name=m_pPrinter->Name;
return(m_name);
}
Is there any way to determine if the new printer is licenced?
Any help would be very much appreciated.
Steve.
The application is running on Windows Server 2012 R2.
The version of Word comes from Microsoft Office Professional Plus 2013.
The printer is created using the following code:
#import "progid:PXCComLib.CPXCControlEx" rename_namespace("PXC"), named_guids, exclude("IStream","ISequentialStream","_LARGE_INTEGER","_ULARGE_INTEGER","tagSTATSTG","_FILETIME")
class PDFXCHANGE
{
private:
PXC::IPXCPrinterPtr m_pPrinter;
PXC::IPXCControlExPtr m_pFactory;
_bstr_t m_name;
public:
PDFXCHANGE();
~PDFXCHANGE();
TXD_BOOL init(const TXD_STR *fspec);
const TXD_STR *getname();
TXD_VOID deinit();
};
TXD_BOOL PDFXCHANGE::init(const TXD_STR *fspec)
{
for (;;)
{
if (m_pFactory==NULL)
{
try
{
CLSID clsid;
if (SUCCEEDED(CLSIDFromProgID(L"PXCComLib.CPXCControlEx",&clsid)))
m_pFactory = PXC::IPXCControlExPtr(__uuidof(PXC::CPXCControlEx));
}
catch(_com_error &)
{
continue;
}
catch(...)
{
continue;
}
}
if (m_pFactory==NULL)
return(DXD_BOOL_FALSE);
if (m_pPrinter==NULL)
{
try
{
static WCHAR key[]=L"xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx";
static WCHAR devcode[]=L"PDFX3$Xxxxx$999999_Xxxxxxx#";
m_pPrinter = m_pFactory->Printer[L"", L"PDF-XChange 4.0", key, devcode];
// Diagnostic starts
// Log the key and dev code used for each document
TXD_STR log_fspec[LXI_FSPEC_FSPEC+1]={0};
fxk_sys_get_logs_folder(log_fspec);
if (!fxi_dir_exists(log_fspec))
fxk_sys_makedir(log_fspec);
fxd_str_cat(log_fspec,"PDF\\");
if (!fxi_dir_exists(log_fspec))
fxk_sys_makedir(log_fspec);
TXD_STR filename[LXI_FSPEC_SEG+1]={0};
fxi_fspec_getlseg(fspec,filename);
CXI_LFILE_TIMED file;
file.make(CXD_STR().catf("%str%%str%.TXT",log_fspec,filename).c_str());
file.write(CXD_STR().catf("Key : %wstr%",key).c_str());
file.write(CXD_STR().catf("DevCode: %wstr%",devcode).c_str());
file.close();
// Diagnostic ends
}
catch(_com_error &)
{
deinit();
continue;
}
catch(...)
{
deinit();
continue;
}
}
if (m_pPrinter==NULL)
return(DXD_BOOL_FALSE);
break;
}
m_pPrinter->ResetDefaults();
m_pPrinter->Option[L"Save.SaveType"] = L"Save";
m_pPrinter->Option[L"Save.ShowSaveDialog"] = L"No";
_bstr_t p=fspec;
m_pPrinter->Option[L"Save.File"] = (BSTR)p;
m_pPrinter->Option[L"Save.WhenExists"] = L"Overwrite";
m_pPrinter->Option[L"Save.RunApp"] = FALSE;
m_pPrinter->Option[L"Overlay.Enabled"] = FALSE;
m_pPrinter->Option[L"Compression.Graphics"] = TRUE;
m_pPrinter->Option[L"Compression.Text"] = TRUE;
m_pPrinter->Option[L"Fonts.EmbedAll"] = FALSE;
m_pPrinter->Option[L"Saver.ShowProgress"] = FALSE;
m_pPrinter->ApplyOptions(0);
return(DXD_BOOL_TRUE);
}
const TXD_STR *PDFXCHANGE::getname()
{
m_name=m_pPrinter->Name;
return(m_name);
}
Is there any way to determine if the new printer is licenced?
Any help would be very much appreciated.
Steve.