⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pdfcmdsampledlg.cpp

📁 i am server im imi mim im im
💻 CPP
📖 第 1 页 / 共 4 页
字号:
		try
		{
			m_pPDFPageEdit->Delete();
		}
		catch(_com_error e)
		{
			AfxMessageBox(e.Description());
		}
	}
	else
		AfxMessageBox("You have not open a file or a pages!");
}

void CPDFCMDSampleDlg::OnPageGetpagewh() 
{
	// TODO: Add your command handler code here
	CPageSizeDlg pagesizedlg;
	if(bFileOpened&&bPageOpened)
	{
		try
		{
			m_pPDFPageEdit->GetPageWidthHeight(FALSE,&pagesizedlg.m_width,&pagesizedlg.m_height);
		}
		catch(_com_error e)
		{
			AfxMessageBox(e.Description());
		}
		pagesizedlg.DoModal();
	}
	else
		AfxMessageBox("There are no opened file or pages!");
}

void CPDFCMDSampleDlg::OnPageClose() 
{
	// TODO: Add your command handler code here
	if( bFileOpened && bPageOpened )
	{
		m_pPDFPageEdit->Close();
		bPageOpened = FALSE;
	}
}

void CPDFCMDSampleDlg::OnCombineAddfile() 
{
	// TODO: Add your command handler code here
	CString szFileName;
	CFileDialog dlg( TRUE, _T("pdf"), NULL, OFN_FILEMUSTEXIST|OFN_OVERWRITEPROMPT, _T("PDF Files(*.pdf)|*.pdf||") ) ;
	if (dlg.DoModal() == IDOK)
	{
		szFileName = dlg.GetPathName();
		if (szFileName.IsEmpty()) 
			return ;
		else
		{
			try
			{
				m_pPDFCombine->AddFile((_bstr_t)szFileName,"");
			}
			catch(_com_error e)
			{
				AfxMessageBox(e.Description());
			}
			m_ClistBox_FileName.AddString(szFileName);
		}
	}
}

void CPDFCMDSampleDlg::OnCombineConcate() 
{
	// TODO: Add your command handler code here
	CString strFileName;
	int iCount = m_ClistBox_FileName.GetCount();
	BOOL bIsPDF = FALSE,bFlag = FALSE;
	char *buf;
	buf = new char[MAX_PATH + 1];
	if(iCount > 0)
	{
		for(int i = 0 ; i < iCount ; i++)                   
		{
			m_ClistBox_FileName.GetText(i, strFileName);
			buf = strrchr(strFileName,'.');
			buf = buf + 1;
			bIsPDF = IsFileTypePDF(buf);
			if(bIsPDF)
			{
				m_pPDFCombine->AddFile(strFileName.AllocSysString(),_T(""));
				bFlag = TRUE;
			}		
		}
		if(bFlag == FALSE)
		{
			AfxMessageBox("You must add a PDF file or more.");
			return;
		}
	}
	else
	{
		AfxMessageBox("You must add a PDF file or more.");
		return;
	}
	CFileDialog dlg( FALSE, _T("pdf"), NULL, OFN_FILEMUSTEXIST|OFN_OVERWRITEPROMPT, _T("PDF Files (*.pdf)|*.pdf||")) ;
	if (dlg.DoModal() == IDOK)
	{
		CString FilePath = dlg.GetPathName() ;
        if (!FilePath.IsEmpty())
		{
            _bstr_t dzPath = FilePath;
			try
			{
				m_pPDFCombine->Concate(dzPath);
			}
			catch (_com_error e) 
			{
				AfxMessageBox(e.Description());
			}
		}
	}	
}

void CPDFCMDSampleDlg::OnCombineOverlay() 
{
	// TODO: Add your command handler code here
	CString strFileName;
	int iCount = m_ClistBox_FileName.GetCount();
	BOOL bIsPDF = FALSE,bFlag = FALSE;
	char *buf;
	buf = new char[MAX_PATH + 1];
	if((iCount > 0))
	{
		for(int i = 0 ; i < iCount ; i++)                   
		{
			m_ClistBox_FileName.GetText(i, strFileName);
			buf = strrchr(strFileName,'.');
			buf = buf + 1;
			bIsPDF = IsFileTypePDF(buf);
			if(bIsPDF)
			{
				m_pPDFCombine->AddFile(strFileName.AllocSysString(),_T(""));
				bFlag = TRUE;
			}
		}
		if(bFlag== FALSE)
		{
			AfxMessageBox("You must add a  PDF file or more.");
			return;
		}
	}
	else
	{
			AfxMessageBox("You must add a PDF file or more.");
			return;
	}
	CFileDialog dlg( FALSE, _T("pdf"), NULL, OFN_FILEMUSTEXIST|OFN_OVERWRITEPROMPT, _T("PDF Files (*.pdf)|*.pdf||") ) ;
	if (dlg.DoModal() == IDOK)
	{
		CString FilePath = dlg.GetPathName( ) ;
        if (!FilePath.IsEmpty( ))
		{
            _bstr_t dzPath = FilePath;
			try
			{
				m_pPDFCombine->Overlay(dzPath);
			}
			catch (_com_error e) 
			{
				AfxMessageBox(e.Description());
			}
		}
	}	
}

void CPDFCMDSampleDlg::OnCombineOverlaysetting() 
{
	// TODO: Add your command handler code here
	CMergeSettingDlg mergesettingdlg;
	MergeOrderEnum enummergeorder;
	BSTR bstranchor;
	try
	{
		m_pPDFCombine->get_MergeOrder(&enummergeorder);
		mergesettingdlg.lmergeorder=enummergeorder;
		m_pPDFCombine->get_Anchor(&bstranchor);
		mergesettingdlg.m_anchor=bstranchor;
		m_pPDFCombine->get_MergeRepeat((VARIANT_BOOL*)&mergesettingdlg.m_mergerepeat);
	}
	catch(_com_error e)
	{
		AfxMessageBox(e.Description());
	}
	if(mergesettingdlg.DoModal() == IDOK)
	{
		switch(mergesettingdlg.lmergeorder)
		{
		case 0:
			enummergeorder = MO_Background;
			break;
		case 1:
			enummergeorder = MO_Foreground;
			break;
		}
		m_pPDFCombine->put_MergeOrder(enummergeorder);
		m_pPDFCombine->put_Anchor(mergesettingdlg.m_anchor.AllocSysString());
		m_pPDFCombine->put_MergeRepeat((VARIANT_BOOL)mergesettingdlg.m_mergerepeat);
	}
}

void CPDFCMDSampleDlg::OnWtmkPosition() 
{
}

void CPDFCMDSampleDlg::OnWatermarkTextwtmkinfo() 
{
	// TODO: Add your command handler code here
    BSTR Text;
	short Text_Check;
    FontStyleEnum TextFontStyle;
	CTextWatermarkInfo TextWatermarkInfoDlg(this);
	try
	{
		m_pPDFTextWatermarkInfo->get_Text(&Text);
		TextWatermarkInfoDlg.m_String_Text = Text;
		m_pPDFTextWatermarkInfo->get_TextFont(&Text);
		TextWatermarkInfoDlg.m_String_TextFont = Text;
		m_pPDFTextWatermarkInfo->get_TextSize(&TextWatermarkInfoDlg.m_long_TextSize);
		m_pPDFTextWatermarkInfo->get_TextStyle(&TextFontStyle);
		TextWatermarkInfoDlg.m_int_TextStyle = TextFontStyle;
		m_pPDFTextWatermarkInfo->get_TextColorRed(&TextWatermarkInfoDlg.m_long_TextColorRed);
		m_pPDFTextWatermarkInfo->get_TextColorGreen(&TextWatermarkInfoDlg.m_long_TextColorGreen);
		m_pPDFTextWatermarkInfo->get_TextColorBlue(&TextWatermarkInfoDlg.m_long_TextColorBlue);
		m_pPDFTextWatermarkInfo->get_Angle(&TextWatermarkInfoDlg.m_long_TextAngle);
		m_pPDFTextWatermarkInfo->get_Opacity(&TextWatermarkInfoDlg.m_double_TextOpacity);
		m_pPDFTextWatermarkInfo->get_OutlineOnly(&Text_Check);
		TextWatermarkInfoDlg.m_OutlineOnly = (BOOL)Text_Check;
	}
	catch (_com_error e) 
	{
		AfxMessageBox(e.Description());
	}
	TextWatermarkInfoDlg.DoModal();
}

void CPDFCMDSampleDlg::OnWtmkAddtextwtmk() 
{
	// TODO: Add your command handler code here
	if(bFileOpened)
	{
		bSave = TRUE;
		try
		{
			m_pPDFTextWatermarkInfo->AddWatermark();
		}
		catch (_com_error e)
		{
			AfxMessageBox(e.Description());
		}
	}
}

void CPDFCMDSampleDlg::OnWtmkIconwtmkinfo() 
{
	// TODO: Add your command handler code here
	CIconWatermarkInfo Iconwatermarkdlg( this );
	try
	{
		m_pPDFIconWatermarkInfo->get_Width(&Iconwatermarkdlg.m_width);
		m_pPDFIconWatermarkInfo->get_Height(&Iconwatermarkdlg.m_height);
		m_pPDFIconWatermarkInfo->get_CoverWholePage((VARIANT_BOOL*)&Iconwatermarkdlg.m_coverwholepage);
		m_pPDFIconWatermarkInfo->get_KeepRatio((VARIANT_BOOL*)&Iconwatermarkdlg.m_keepratio);
		m_pPDFIconWatermarkInfo->get_MarkedAreaOnly((VARIANT_BOOL*)&Iconwatermarkdlg.m_markedareaonly);
		m_pPDFIconWatermarkInfo->get_PageIdentifier(&Iconwatermarkdlg.m_pageidentifier);
		m_pPDFIconWatermarkInfo->get_Opacity(&Iconwatermarkdlg.m_opacity);
	}
	catch (_com_error e) 
	{
		AfxMessageBox(e.Description());
	}
	Iconwatermarkdlg.DoModal();
}

void CPDFCMDSampleDlg::OnWtmkAddiconwtmk() 
{
	// TODO: Add your command handler code here
	if(bFileOpened)
	{
		bSave = TRUE;
		try
		{
			m_pPDFIconWatermarkInfo->AddWatermark();
		}
		catch (_com_error e)
		{
			AfxMessageBox(e.Description());
		}
	}
}

void CAboutDlg::OnOK() 
{
	// TODO: Add extra validation here
	TRACE("Executable filename = %s\n", AfxGetApp()->m_pszExeName);
	CDialog::OnOK();
}

void CPDFCMDSampleDlg::OnSearch() 
{
	// TODO: Add your command handler code here
	char *strExePath;
	strExePath = new char[MAX_PATH+1];
	GetModuleFileNameA( NULL , strExePath , MAX_PATH );
	char *p = strrchr( strExePath, '\\' );
	if (NULL == p)
		return  ;
	strcpy(p,"");
	ShellExecuteA( NULL, NULL, "TestZnPDFLibrarianDLL.exe",  NULL,(LPCSTR)strExePath, SW_SHOW ) ;
}

void CPDFCMDSampleDlg::OnPrint() 
{
	// TODO: Add your command handler code here
	char *strExePath;
	strExePath = new char[MAX_PATH+1];
	GetModuleFileNameA( NULL , strExePath , MAX_PATH );
	char *p = strrchr( strExePath, '\\' );
	if (NULL == p)
		return  ;
	strcpy(p,"");
	ShellExecuteA( NULL, NULL, "TextznPDFPrintDLL.exe",  NULL,(LPCSTR)strExePath, SW_SHOW ) ;
}

void CPDFCMDSampleDlg::OnTextwatermarkset() 
{
	// TODO: Add your command handler code here
}

void CPDFCMDSampleDlg::OnAddImageWatermark() 
{
	// TODO: Add your command handler code here
}
	
void CPDFCMDSampleDlg::OnAddTextWatermark() 
{
	// TODO: Add your command handler code here
}
	
void CPDFCMDSampleDlg::OnSerialNumber() 
{
	// TODO: Add your command handler code here
		try
		{
			CoInitialize(NULL);
			m_pPDFCreate->Initialize( _T(""), 0);
			m_pPDFCmd->Initialize(_T(""), 0);
		}
		catch (_com_error e) 
		{
			AfxMessageBox(e.Description());
		}
}
	
void CPDFCMDSampleDlg::OnRunSearch() 
{
		// TODO: Add your command handler code here
		char *strExePath;
		strExePath = new char[MAX_PATH+1];
		GetModuleFileNameA( NULL , strExePath , MAX_PATH );
		char *p = strrchr( strExePath, '\\' );
		if (NULL == p)
			return  ;
		strcpy(p,"");
		ShellExecuteA( NULL, NULL, "TestZnPDFLibrarianDLL.exe",  NULL,(LPCSTR)strExePath, SW_SHOW ) ;
}
	
void CPDFCMDSampleDlg::OnPdfPrint() 
{
		// TODO: Add your command handler code here
		char *strExePath;
		strExePath = new char[MAX_PATH+1];
		GetModuleFileNameA( NULL , strExePath , MAX_PATH );
		char *p = strrchr( strExePath, '\\' );
		if (NULL == p)
			return  ;
		strcpy(p,"");
		ShellExecuteA( NULL, NULL, "TestznPDFPrintDLL.exe",  NULL,(LPCSTR)strExePath, SW_SHOW ) ;
}
	
void CPDFCMDSampleDlg::OnHelp() 
{
	// TODO: Add your command handler code here
	CAboutDlg AboutDlg;
	AboutDlg.DoModal();
}
	
void CPDFCMDSampleDlg::AddImageWatermarkSetting()
{
}

void CPDFCMDSampleDlg::AddTextWatermarkSetting()
{
}

void CPDFCMDSampleDlg::OnUpdateFileNew(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
}

void CPDFCMDSampleDlg::OnForm() 
{
	// TODO: Add your command handler code here
	if(bFileOpened && bFormOpen)
	{
		
		CFormDLG FormDlg(this);
		FormDlg.DoModal();
	}
	else
	{
		AfxMessageBox("You must open a PDF file.");
	}
}

void CPDFCMDSampleDlg::OnRemoveAllFile() 
{
	// TODO: Add your command handler code here
	int icount = m_ClistBox_FileName.GetCount();
	for(int i = 0; i < icount ; i++)
	{
		m_ClistBox_FileName.DeleteString(0);
	}
}

void CPDFCMDSampleDlg::OnReference() 
{
	// TODO: Add your command handler code here
	
	char *strReferenceFilePath;
	strReferenceFilePath = new char[MAX_PATH];
	memset(strReferenceFilePath,0,MAX_PATH); 
	GetSystemDirectory(strReferenceFilePath,MAX_PATH);
	char *p = strchr(strReferenceFilePath, '\\');
	p = p + 1; 
	strcpy(p,"");
	strcat(strReferenceFilePath , "Program Files\\zeon\\DocuCom\\doc");
	ShellExecuteA(NULL, NULL, "PDF Server API Reference.pdf",  NULL,(LPCSTR)strReferenceFilePath, SW_SHOW);
	
}

BOOL CAboutDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	WebLink.SetURL(Web);
	WebLink.SetUnderline(1);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPDFCMDSampleDlg::OnPrintToImage() 
{
	// TODO: Add your command handler code here

}

void CPDFCMDSampleDlg::OnPrintToImageSet() 
{
	// TODO: Add your command handler code here
	CPrintToImageDlg ImgDlg(this);
	if(ImgDlg.DoModal() != IDOK)
	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -