// PDFCompDemoView.cpp : implementation of the CPDFCompDemoView class // #include "stdafx.h" #include "PDFCompDemo.h" #include "PDFCompDemoDoc.h" #include "PDFCompDemoView.h" #include "PDFCompSetDlg.h" #include "PDFOptions.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern L_VOID PDFCompError(HWND hwnd, L_INT nCode, L_TCHAR* pTitle, L_TCHAR* pFilename); ///////////////////////////////////////////////////////////////////////////// // CPDFCompDemoView IMPLEMENT_DYNCREATE(CPDFCompDemoView, CScrollView) BEGIN_MESSAGE_MAP(CPDFCompDemoView, CScrollView) //{{AFX_MSG_MAP(CPDFCompDemoView) ON_WM_SIZE() ON_WM_LBUTTONDBLCLK() ON_COMMAND(ID_PDFCOMP_OPTIONS_ADD, OnPdfcompOptionsAdd) ON_COMMAND(ID_PDFCOMP_OPTIONS_DEL, OnPdfcompOptionsDel) ON_COMMAND(ID_PDFCOMP_OPTIONS_MOD, OnPdfcompOptionsMod) ON_UPDATE_COMMAND_UI(ID_PDFCOMP_OPTIONS_DEL, OnUpdatePdfcompOptionsDel) ON_UPDATE_COMMAND_UI(ID_PDFCOMP_OPTIONS_ADD, OnUpdatePdfcompOptionsAdd) ON_UPDATE_COMMAND_UI(ID_PDFCOMP_OPTIONS_MOD, OnUpdatePdfcompOptionsMod) ON_WM_ERASEBKGND() ON_COMMAND(ID_FILE_SAVEALL, OnFileSaveAll) ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview) ON_COMMAND(ID_PDFCOMP_OPTIONS_ADVANCE, OnPdfcompOptionsAdvance) //}}AFX_MSG_MAP // Standard printing commands ON_COMMAND(ID_FILE_PRINT, CScrollView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPDFCompDemoView construction/destruction CPDFCompDemoView::CPDFCompDemoView() { // TODO: add construction code here } CPDFCompDemoView::~CPDFCompDemoView() { CPDFCompDemoDoc* pDoc = GetDocument(); CPDFCompDemoApp * pApp = (CPDFCompDemoApp *)AfxGetApp(); if(pDoc->m_PDFCompSettings.bAdded == TRUE) { pDoc->m_PDFCompSettings.bAdded = FALSE; pApp->SetPageOrder(pDoc->m_PDFCompSettings.nPageNumber, FALSE, TRUE, -1); } } BOOL CPDFCompDemoView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CScrollView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CPDFCompDemoView drawing void CPDFCompDemoView::OnDraw(CDC* pDC) { CPDFCompDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here RECT rLeadDest; CPalette* ppalSave=NULL; CPalette* pPalette; pPalette = CreatePaintPalette( pDC ); ppalSave = pDC->SelectPalette(pPalette , TRUE); pDC->RealizePalette(); SetRect( &rLeadDest, 0, 0,BITMAPWIDTH (&pDoc->m_LeadBitmap) , BITMAPHEIGHT(&pDoc->m_LeadBitmap) ); L_PaintDC( pDC->m_hDC,&pDoc->m_LeadBitmap, NULL, NULL, &rLeadDest, NULL, SRCCOPY ); BITMAPHANDLE KeyBitmap; RECT KeyRect; HDC keyDC; CString pszStatus; CString pszIndex; COLORREF rgbFill; HPEN hOldPen; HBRUSH hOldBrush; HFONT hOldFont; if( pDoc->m_LeadBitmap.Width >= 150 && pDoc->m_LeadBitmap.Height >= 150 ) { if(pDoc->m_PDFCompSettings.bAdded) { pszStatus = " Status : ADDED\n"; pszIndex.Format(TEXT(" Page Index : %d\n"),pDoc->m_PDFCompSettings.nPageNumber); pszStatus += pszIndex; if(!pDoc->m_PDFCompSettings.m_bNOMRC) { pszStatus += " Input Quality: "; switch(pDoc->m_PDFCompSettings.nPDFComboSel) { case 0: pszStatus += "Auto"; break; case 1: pszStatus += "Noisy"; break; case 2: pszStatus += "Scanned"; break; case 3: pszStatus += "Printed"; break; case 4: pszStatus += "Computer Generated"; break; case 5: pszStatus += "Photo"; break; case 6: pszStatus += "User Defined"; break; } pszStatus += "\n Output Quality : "; switch(pDoc->m_PDFCompSettings.nImgQComboSel) { case 0: pszStatus += "Auto"; break; case 1: pszStatus += "Poor"; break; case 2: pszStatus += "Average"; break; case 3: pszStatus += "Good"; break; case 4: pszStatus += "Excellent"; break; case 5: pszStatus += "User Defined"; break; } } } else { pszStatus = " Status : NOT ADDED"; } SetBkMode( pDC->m_hDC, TRANSPARENT ); LOGFONT LogFont; memset( &LogFont, 0, sizeof( LogFont ) ); LogFont.lfHeight = 18; LogFont.lfWeight = FW_BOLD; strcpy( (char *)LogFont.lfFaceName, (char *)TEXT("Arial") ); hOldFont = SelectFont( pDC->m_hDC, CreateFontIndirect( &LogFont ) ); memset( &KeyRect, 0, sizeof( KeyRect ) ); KeyRect.right = BITMAPWIDTH (&pDoc->m_LeadBitmap); DrawText( pDC->m_hDC, pszStatus, pszStatus.GetLength() , &KeyRect, DT_LEFT | DT_WORDBREAK | DT_CALCRECT ); L_INT nRet = L_CreateBitmap( &KeyBitmap, sizeof(BITMAPHANDLE), TYPE_CONV, KeyRect.right, KeyRect.bottom, 24, ORDER_BGR, NULL, pDoc->m_LeadBitmap.ViewPerspective, NULL, 0 ); if( pDoc->m_PDFCompSettings.bAdded ) rgbFill = RGB(0,255,0); else rgbFill = RGB(255,0,0); L_FillBitmap( &KeyBitmap, rgbFill ); keyDC = L_CreateLeadDC( &KeyBitmap ); hOldBrush = SelectBrush( keyDC, GetStockBrush( NULL_BRUSH ) ); hOldPen = SelectPen( keyDC, CreatePen( PS_NULL, 3, 0 ) ); Rectangle( keyDC, 0, 0, KeyRect.right - KeyRect.left, KeyRect.bottom - KeyRect.top ); DeletePen( SelectPen( keyDC, hOldPen ) ); DeleteBrush( SelectBrush( keyDC, hOldBrush ) ); DeleteFont( SelectFont( pDC->m_hDC, hOldFont ) ); BLENDFUNCTION BlendFunc; BlendFunc.AlphaFormat = 0; BlendFunc.SourceConstantAlpha = 120; BlendFunc.BlendFlags = 0; BlendFunc.BlendOp = 0; /* AC_SRC_OVER */ AlphaBlend( pDC->m_hDC, KeyRect.left, KeyRect.top, KeyRect.right, KeyRect.bottom, keyDC, 0, 0, KeyRect.right - KeyRect.left, KeyRect.bottom - KeyRect.top, BlendFunc ); DrawText( pDC->m_hDC, pszStatus, pszStatus.GetLength(), &KeyRect, DT_LEFT | DT_WORDBREAK ); m_StatusRect.CopyRect(&KeyRect); L_DeleteLeadDC(keyDC); if(KeyBitmap.Flags.Allocated) L_FreeBitmap(&KeyBitmap); } } inline HPALETTE CPDFCompDemoView::CreatePaintPalette(HDC hDC) { CPDFCompDemoDoc* pDoc = GetDocument(); return(L_CreatePaintPalette(hDC, &pDoc->m_LeadBitmap)); } inline CPalette* CPDFCompDemoView::CreatePaintPalette(CDC *pDC) { HPALETTE hPalette; CPalette *pPalette = NULL; hPalette = CreatePaintPalette(pDC->m_hDC); if(hPalette) { pPalette = new CPalette; pPalette->Attach(hPalette); } return(pPalette); } void CPDFCompDemoView::OnInitialUpdate() { CScrollView::OnInitialUpdate(); CSize sizeTotal; // TODO: calculate the total size of this view sizeTotal.cx = sizeTotal.cy = 100; SetScrollSizes(MM_TEXT, sizeTotal); SizingWindow(); } ///////////////////////////////////////////////////////////////////////////// // CPDFCompDemoView printing BOOL CPDFCompDemoView::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } void CPDFCompDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add extra initialization before printing } void CPDFCompDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add cleanup after printing } ///////////////////////////////////////////////////////////////////////////// // CPDFCompDemoView diagnostics #ifdef _DEBUG void CPDFCompDemoView::AssertValid() const { CScrollView::AssertValid(); } void CPDFCompDemoView::Dump(CDumpContext& dc) const { CScrollView::Dump(dc); } CPDFCompDemoDoc* CPDFCompDemoView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPDFCompDemoDoc))); return (CPDFCompDemoDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CPDFCompDemoView message handlers L_VOID CPDFCompDemoView::SizingWindow() { CPDFCompDemoDoc* pDoc = GetDocument(); CRect rcDst; GetParent()->SetWindowText(GetDocument()->GetPathName()); rcDst.SetRect(0, 0, MulDiv(pDoc->m_LeadBitmap.Width, 100, 100), MulDiv(pDoc->m_LeadBitmap.Height, 100, 100)); CSize sizeTotal( rcDst.Width(), rcDst.Height() ); SetScrollSizes(MM_TEXT, sizeTotal); } void CPDFCompDemoView::OnSize(UINT nType, int cx, int cy) { CScrollView::OnSize(nType, cx, cy); // TODO: Add your message handler code here } void CPDFCompDemoView::OnPdfcompOptionsAdd() { CPDFCompDemoDoc* pDoc = GetDocument(); CPDFCompSetDlg SettingDlg; if(pDoc->m_PDFCompSettings.bAdded) { SettingDlg.m_nBKThreshold = pDoc->m_PDFCompSettings.nBKThreshold ; SettingDlg.m_nCleanSize = pDoc->m_PDFCompSettings.nCleanSize; SettingDlg.m_nCLRThreshold = pDoc->m_PDFCompSettings.nCLRThreshold; SettingDlg.m_nCombThreshold = pDoc->m_PDFCompSettings.nCombThreshold; SettingDlg.m_nSegQuality = pDoc->m_PDFCompSettings.nSegQuality ; SettingDlg.m_bAdded = pDoc->m_PDFCompSettings.bAdded; SettingDlg.m_nPDFComboSel = pDoc->m_PDFCompSettings.nPDFComboSel; SettingDlg.m_nImgQComboSel = pDoc->m_PDFCompSettings.nImgQComboSel; SettingDlg.m_nPageOrder = pDoc->m_PDFCompSettings.nPageNumber; SettingDlg.m_bNOMRC = pDoc->m_PDFCompSettings.m_bNOMRC; } else { SettingDlg.m_bAdded = 0; } if(IDOK == SettingDlg.DoModal()) { if(SettingDlg.m_bAdded) { pDoc->m_PDFCompSettings.nBKThreshold = SettingDlg.m_nBKThreshold; pDoc->m_PDFCompSettings.nCleanSize = SettingDlg.m_nCleanSize; pDoc->m_PDFCompSettings.nCLRThreshold = SettingDlg.m_nCLRThreshold; pDoc->m_PDFCompSettings.nCombThreshold = SettingDlg.m_nCombThreshold; pDoc->m_PDFCompSettings.nSegQuality = SettingDlg.m_nSegQuality; pDoc->m_PDFCompSettings.bAdded = SettingDlg.m_bAdded; pDoc->m_PDFCompSettings.nPDFComboSel = SettingDlg.m_nPDFComboSel; pDoc->m_PDFCompSettings.nImgQComboSel = SettingDlg.m_nImgQComboSel; pDoc->m_PDFCompSettings.nPageNumber = SettingDlg.m_nPageOrder; pDoc->m_PDFCompSettings.m_bNOMRC = SettingDlg.m_bNOMRC; } else { pDoc->m_PDFCompSettings.bAdded = FALSE; } } Invalidate(); } void CPDFCompDemoView::OnPdfcompOptionsDel() { CPDFCompDemoDoc* pDoc = GetDocument(); CPDFCompDemoApp * pApp = (CPDFCompDemoApp *)AfxGetApp(); pDoc->m_PDFCompSettings.bAdded = FALSE; pApp->SetPageOrder(pDoc->m_PDFCompSettings.nPageNumber, FALSE, TRUE, -1); Invalidate(); } void CPDFCompDemoView::OnPdfcompOptionsMod() { // TODO: Add your command handler code here OnPdfcompOptionsAdd(); } void CPDFCompDemoView::OnUpdatePdfcompOptionsAdd(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here CPDFCompDemoDoc* pDoc = GetDocument(); if(pDoc->m_PDFCompSettings.bAdded) pCmdUI->Enable(FALSE); else pCmdUI->Enable(TRUE); } void CPDFCompDemoView::OnUpdatePdfcompOptionsMod(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here CPDFCompDemoDoc* pDoc = GetDocument(); if(pDoc->m_PDFCompSettings.bAdded) pCmdUI->Enable(TRUE); else pCmdUI->Enable(FALSE); } void CPDFCompDemoView::OnUpdatePdfcompOptionsDel(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here CPDFCompDemoDoc* pDoc = GetDocument(); if(pDoc->m_PDFCompSettings.bAdded) pCmdUI->Enable(TRUE); else pCmdUI->Enable(FALSE); } void CPDFCompDemoView::OnLButtonDblClk(UINT nFlags, CPoint point) { if(m_StatusRect.PtInRect(point)) { OnPdfcompOptionsAdd() ; } CScrollView::OnLButtonDblClk(nFlags, point); } void CPDFCompDemoView::OnUpdatePdfOpAdd(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here // TODO: Add your command update UI handler code here CPDFCompDemoDoc* pDoc = GetDocument(); if(pDoc->m_PDFCompSettings.bAdded) pCmdUI->Enable(FALSE); else pCmdUI->Enable(TRUE); //Invalidate(); } void CPDFCompDemoView::OnUpdatePdfOpDel(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here CPDFCompDemoDoc* pDoc = GetDocument(); if(pDoc->m_PDFCompSettings.bAdded) pCmdUI->Enable(TRUE); else pCmdUI->Enable(FALSE); } void CPDFCompDemoView::OnUpdatePdfOpMod(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here CPDFCompDemoDoc* pDoc = GetDocument(); if(pDoc->m_PDFCompSettings.bAdded) pCmdUI->Enable(TRUE); else pCmdUI->Enable(FALSE); //Invalidate(); } BOOL CPDFCompDemoView::OnEraseBkgnd(CDC* pDC) { // TODO: Add your message handler code here and/or call default CBrush br; br.CreateStockObject(GRAY_BRUSH); FillOutsideRect(pDC, &br); return TRUE;//CScrollView::OnEraseBkgnd(pDC); } void CPDFCompDemoView::OnFileSaveAll() { // TODO: Add your command handler code here CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIChildWnd* pChild = (CMDIChildWnd*)pFrame->GetActiveFrame(); CPDFCompDemoDoc *pDoc= (CPDFCompDemoDoc*)pChild->GetActiveView(); static OPENFILENAME OpenFileName; L_TCHAR szFileName[_MAX_PATH]=_T(""); //SAVEDLGPARAMS FSParm; pPDFCOMPSETTENGS pPDFSettings=NULL; L_INT nRet=SUCCESS; L_INT i=0; do { if (pChild) { pDoc = (CPDFCompDemoDoc*)pChild->GetActiveDocument(); if(pDoc->m_PDFCompSettings.bAdded) { pPDFSettings = (pPDFCOMPSETTENGS) realloc(pPDFSettings,sizeof(PDFCOMPSETTENGS)*(i+1)); memcpy(&pPDFSettings[i], &pDoc->m_PDFCompSettings, sizeof(PDFCOMPSETTENGS)) ; pPDFSettings[i].pBitmap = &pDoc->m_LeadBitmap; i++; } } pChild = (CMDIChildWnd*) pChild->GetWindow(GW_HWNDNEXT); } while (pChild); if(0 == i) { MessageBox(TEXT("No image is added"), TEXT("PDFComp Demo"), MB_ICONEXCLAMATION); } else { OPENFILENAME OpenFileName; L_TCHAR szSaveFileFilter[] = {TEXT("Acrobat (*.pdf)\0") TEXT("*.pdf\0")}; L_TCHAR *pFileName=NULL; ZeroMemory( &OpenFileName, sizeof( OPENFILENAME ) ); OpenFileName.lStructSize = sizeof( OPENFILENAME ); OpenFileName.hwndOwner = m_hWnd; OpenFileName.hInstance = NULL; OpenFileName.lpstrFilter = szSaveFileFilter; OpenFileName.lpstrCustomFilter = NULL; OpenFileName.nMaxCustFilter = 0; OpenFileName.lpstrFile = szFileName; OpenFileName.nFilterIndex = 1; OpenFileName.nMaxFile = sizeof( szFileName )/sizeof(L_TCHAR); OpenFileName.lpstrFileTitle = szFileName; OpenFileName.nMaxFileTitle = sizeof( szFileName )/sizeof(L_TCHAR); OpenFileName.lpstrInitialDir = NULL; OpenFileName.lpstrTitle = TEXT("Save to PDF"); OpenFileName.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; OpenFileName.nFileOffset = 0; OpenFileName.nFileExtension = 0; OpenFileName.lpstrDefExt = TEXT(""); OpenFileName.lCustData = 0L; OpenFileName.lpfnHook = NULL; OpenFileName.lpTemplateName = NULL; if(!GetSaveFileName( &OpenFileName )) return; //Sort documents depending on page number ApplySort(pPDFSettings, i); //Save to MRC nRet = ApplyPDFSave (OpenFileName.lpstrFile, pPDFSettings, i ); if(pPDFSettings) free(pPDFSettings); if(SUCCESS != nRet) MessageBox(TEXT("PDF Save Error"), TEXT("PDFComp Demo"), MB_ICONEXCLAMATION); } } L_VOID CPDFCompDemoView::ApplySort( pPDFCOMPSETTENGS pPDFSettings, L_INT nSize ) { PDFCOMPSETTENGS HoldPDFSettings; L_INT x, y; for(x = 0; x < nSize; x++) { for(y = 0; y < nSize-1; y++) { if(pPDFSettings[y].nPageNumber > pPDFSettings[y+1].nPageNumber) { HoldPDFSettings = pPDFSettings[y+1]; pPDFSettings[y+1] = pPDFSettings[y]; pPDFSettings[y] = HoldPDFSettings; } } } } L_INT CPDFCompDemoView::ApplyPDFSave( L_TCHAR *pFileName, pPDFCOMPSETTENGS pPDFSettings, L_INT nSize ) { // TODO: Add your command handler code here L_INT nRet=SUCCESS; LCPDF_HANDLE hDocument; PDFCOMPOPTIONS PDFOptions; PDFCOMPRESSION pdfComp; L_INT i; ZeroMemory( &PDFOptions, sizeof(PDFCOMPOPTIONS) ); nRet = L_PdfCompInit( &hDocument, NULL, NULL); if(nRet != SUCCESS) return nRet; for(i=0; i< nSize; i++ ) { pdfComp.uStructSize = sizeof(PDFCOMPRESSION); pdfComp.dwFlags = PDFCOMP_1BITCOMPTYPE_ENABLED | PDFCOMP_2BITCOMPTYPE_ENABLED | PDFCOMP_PICTURECOMPTYPE_ENABLED; pdfComp.comp1Bit = (PDFCOMP_1BITCOMPTYPE)pPDFSettings[i].m_n1Bit; pdfComp.comp2Bit = (PDFCOMP_2BITCOMPTYPE)pPDFSettings[i].m_n2Bit; pdfComp.compPicture= (PDFCOMP_PICTURECOMPTYPE)pPDFSettings[i].m_nPict; pdfComp.nQFactor = pPDFSettings[i].m_nQFactor; nRet = L_PdfCompSetCompression( hDocument, &pdfComp ); if(SUCCESS != nRet) return nRet; if(pPDFSettings[i].m_bNOMRC ) { nRet = L_PdfCompInsertNormal(hDocument, pPDFSettings[i].pBitmap); if(SUCCESS != nRet) return nRet; } else { PDFOptions.uStructSize = sizeof(PDFCOMPOPTIONS); PDFOptions.imageQuality = PDFCOMP_IMAGEQUALITY_USER; PDFOptions.outputQuality = PDFCOMP_OUTPUTQUALITY_USER; PDFOptions.uBackGroundThreshold = pPDFSettings[i].nBKThreshold; PDFOptions.uCleanSize = pPDFSettings[i].nCleanSize; PDFOptions.uColorThreshold = pPDFSettings[i].nCLRThreshold; PDFOptions.uCombineThreshold = pPDFSettings[i].nCombThreshold; PDFOptions.uSegmentQuality = pPDFSettings[i].nSegQuality; PDFOptions.dwFlags = pPDFSettings[i].m_nSeg; if( FALSE == pPDFSettings[i].m_bCheckBackground ) PDFOptions.dwFlags |= PDFCOMP_WITHOUT_BACKGROUND; nRet = L_PdfCompInsertMRC( hDocument, pPDFSettings[i].pBitmap, &PDFOptions ); if(SUCCESS != nRet) return nRet; } } nRet = L_PdfCompWrite( hDocument, pFileName); if(nRet != SUCCESS) return nRet; L_PdfCompFree(hDocument); return nRet; } void CPDFCompDemoView::OnFilePrintPreview() { L_INT nRet; PRINTPREVIEWDLGPARAMS PrintPreviewParams; CPDFCompDemoDoc* pDoc = GetDocument(); ZeroMemory(&PrintPreviewParams,sizeof(PRINTPREVIEWDLGPARAMS)); PrintPreviewParams.uStructSize = sizeof ( PRINTPREVIEWDLGPARAMS ) ; PrintPreviewParams.pBitmap = &pDoc->m_LeadBitmap; PrintPreviewParams.nCmdShow = SW_SHOW ;; nRet = L_DlgPrintPreview( AfxGetApp()->m_pMainWnd->m_hWnd, &PrintPreviewParams ) ; if(nRet < SUCCESS ) PDFCompError (AfxGetApp()->m_pMainWnd->m_hWnd, nRet, TEXT("Print Preview"), TEXT("")); if ( NULL != PrintPreviewParams.hDevMode ) { GlobalFree ( PrintPreviewParams.hDevMode ) ; } if ( NULL != PrintPreviewParams.hDevNames ) { GlobalFree ( PrintPreviewParams.hDevNames ) ; } } void CPDFCompDemoView::OnPdfcompOptionsAdvance() { CPDFCompDemoDoc* pDoc = GetDocument(); CPDFOptions OptionsDlg; OptionsDlg.m_n1Bit = pDoc->m_PDFCompSettings.m_n1Bit; OptionsDlg.m_n2Bit = pDoc->m_PDFCompSettings.m_n2Bit; OptionsDlg.m_nPict = pDoc->m_PDFCompSettings.m_nPict; OptionsDlg.m_nSeg = pDoc->m_PDFCompSettings.m_nSeg; OptionsDlg.m_nQFactor = pDoc->m_PDFCompSettings.m_nQFactor; OptionsDlg.m_bCheckBackground = pDoc->m_PDFCompSettings.m_bCheckBackground; if( IDOK == OptionsDlg.DoModal() ) { pDoc->m_PDFCompSettings.m_n1Bit = OptionsDlg.m_n1Bit; pDoc->m_PDFCompSettings.m_n2Bit = OptionsDlg.m_n2Bit; pDoc->m_PDFCompSettings.m_nPict = OptionsDlg.m_nPict; pDoc->m_PDFCompSettings.m_bCheckBackground = OptionsDlg.m_bCheckBackground; pDoc->m_PDFCompSettings.m_nSeg = OptionsDlg.m_nSeg; pDoc->m_PDFCompSettings.m_nQFactor = OptionsDlg.m_nQFactor; } }