我太郁闷了, 这个问题始终困绕着我, 请大家帮忙,Acrobat Reader pdf控件 也没资料,我恨Acrobat Reader pdf控件.
在工程中加入了一个 Acrobat Reader 5.0 的控件, (vc自动产生一个包装类)程序运行时AcroRd32.exe自己运行. 在我的程序里,用 包装类的LoadFile(...)来打pdf开文件显示都没问题.问题是: 包装类中没有找到关闭pdf开文的方法, 因此pdf文件打开多了, 就会有一个消息框,说文件打开的太多,无法打开其它文件, 所以以后pdf文件就显示不出来了.包装类中没有找到清楚当前pdf的方法, 每次要清除显示区域是就用LoadFile("")来处理,
pdf图是没有了,搞得pdf控件区域一片空白.关闭我的应用程序是我掉用了,包装类的
m_Pdfctrl.ExternalRelease();
m_Pdfctrl.ExternalDisconnect();
两个方法(我也不知道它们有什么用), 我的程序关闭后, 但在任务管理器中,AcroRd32.exe 此进程任存在, 我真不知道该怎样去彻底地结束它.我的程序在关闭启动几次,pdf控件就不能在打开文件了.Acrobat Reader 5.0自己关闭时,就没这种现象.

解决方案 »

  1.   

    你在关闭时跟一下m_Pdfctrl.ExternalRelease();要跟进去看看引用计数最后又没有减为0,如果没有就是没有释放掉!
      

  2.   

    免费开发库:
    http://partners.adobe.com/asn/acrobat/sdk/fdftk/FDFToolkitForWindows.zip
    void CPDFAppDlg::OnConvert() 
    {
    // TODO: Add your control notification handler code here
    try
    {
    int iFont;
    PDFlib pPDF;
    CFileDialog m_FileDlg(FALSE,"pdf","",OFN_OVERWRITEPROMPT,"Adobe Acrobat PDF 文件(*.pdf)|*.pdf|所有文件(*.*)|*.*||",this);
    char pFileName[255];

    CEdit* pPDFText=(CEdit*)GetDlgItem(IDC_EDITPDF);
    CString strPDFText;
    pPDFText->GetWindowText(strPDFText);
    char pPDFInfo[1024];
    sprintf(pPDFInfo,"%s",strPDFText); char pAttachFileName[255];
    sprintf(pAttachFileName,"%s",m_AttachFileName);
    if(m_FileDlg.DoModal()==IDOK)
    {
    m_PDFFileName=m_FileDlg.GetFileName();
    sprintf(pFileName,m_PDFFileName);
    if(pPDF.open_file(pFileName)==-1)
    {
    //
    }
    pPDF.set_parameter("hypertextencoding","host");
    pPDF.set_info("Creator","DigitalSky");
    pPDF.set_info("Author","DigitalTitan");
    pPDF.set_info("Title","Title");
    pPDF.begin_page((float)a4_width,(float)a4_height);
    iFont=pPDF.load_font("Helvetica-Bold","host","");
    pPDF.setfont(iFont,12);
    pPDF.set_text_pos(50,a4_height-50);
    pPDF.setcolor("fill","rgb",0,0,1,0);
    pPDF.show("Version 1.0 (C) CopyRight By Digitaltitan");
    iFont=pPDF.findfont("STSong-Light","GB-EUC-H",0);
    pPDF.setcolor("fill","rgb",0,0,0,0);
    pPDF.setfont(iFont,24);
    pPDF.continue_text("转换文档生成为");

    pPDF.setcolor("stroke","rgb",0.24f,0.51f,0.047f,0);
    pPDF.moveto(50,a4_height-80);
    pPDF.lineto(a4_width-50,a4_height-80);
    pPDF.moveto(50,a4_height-78);
    pPDF.lineto(a4_width-50,a4_height-78);
    pPDF.stroke();
    pPDF.attach_file(a4_width-50,0,0,a4_height-90,pAttachFileName,"DigitalSky","DigitalTitan","doc","paperclip"); pPDF.set_text_pos(50,a4_height-100);
    iFont=pPDF.findfont("STSong-Light","GB-EUC-H",0);
    pPDF.setcolor("fill","rgb",0,0,0,0);
    pPDF.setfont(iFont,12);
    pPDF.continue_text(pPDFInfo);

    // pPDF.end_page();
    pPDF.close();
    }
    }
        catch(PDFlib::Exception &ex)
    {
    //
        }
    }
      

  3.   

    最近的VCKbase杂志中有该控件的说明和例子代码