Merge the 2 pdf files into one using vsprint8" and "vsrpt8" ocx

Posted by: ividyullatha on 5 April 2020, 9:29 pm EST

    • Post Options:
    • Link

    Posted 5 April 2020, 9:29 pm EST

    Hi,

    I am using “vsprint8” and “vsrpt8” ocx files to create pdf files.

    ActiveX version : V8.0.20101.156.

    I could not find any function for merge the 2 pdf files into one pdf files.

    Could you help me on how to merge the 2 pdf files into one pdf file using above ocx files.

    Thank you

    Regards,

    Latha

  • Posted 6 April 2020, 8:42 pm EST

    Hi Latha,

    There is no direct way to merge the resultant Pdf files. However, you can achieve your requirement by appending multiple reports to VSPrinter and then use VSPDF object to convert the VSPrinter document to a single PDF file.

    'Loading multiple reports and rendering them as VSPrint files .vp  
    Private Sub cmdMerge_Click()  
      vsr.Load App.Path & "\\Tricky.xml", "Employees" 'vsr= VSReports  
      vsr.RenderToFile App.Path & "\\vsprint1.vp", vsrVSPrinter  
      vsr.Load App.Path & "\\Tricky.xml", "Products"  
      vsr.RenderToFile App.Path & "\\vsprint2.vp", vsrVSPrinter  
      vsr.Load App.Path & "\\Tricky.xml", "Order Report No Params"  
      vsr.RenderToFile App.Path & "\\vsprint3.vp", vsrVSPrinter  
    End Sub 
    

    Now after rendering multiple .vp files, we need to merge them into a single VSPrint document.

    'Appending multiple .vp files to VSPrint document  
    Private Sub cmdGen_Click()  
      vp.LoadDoc "vsprint1.vp", 1  
      vp.LoadDoc "vsprint2.vp", 1  
      vp.LoadDoc "vsprint3.vp", 1  
    End Sub  
    

    Rendering VSPrint doc to PDF using VSPdf:

    'Rendering VSPrint Doc into PDF  
    Private Sub cmdGen\_PDF\_Click()  
      vsp.ConvertDocument vp, App.Path & "\\new.pdf"  ' COnverting VSPrint into VSPdf  
    End Sub
    

    Thanks,

    Pragati

  • Posted 6 April 2020, 9:09 pm EST

    Hi Pragathi,

    Thank you for response…

    I am using these classes in VC++.

    In below way, merging and printing the document.

    I am able to merge the document now.

    void CVSReportHost::LoadAndPrintReport(_bstr_t FileName, _bstr_t Filename2)

    {

    m_IDC_VSPRINTER1->LoadDoc(FileName, 1);

    m_IDC_VSPRINTER1->LoadDoc(Filename2, 1);

    m_IDC_VSPRINTER1->PrintDoc();

    }

    Thanks&Regards,

    Latha

  • Posted 6 April 2020, 10:03 pm EST

    Thanks for letting me know, Latha. I am glad that it worked!

  • Posted 28 April 2020, 6:06 pm EST - Updated 29 September 2022, 2:44 am EST

  • Posted 28 April 2020, 6:10 pm EST

    Hello,

    I want to save the pdf file after merge the document into single. Could you suggest?

    void CVSReportHost::LoadAndPrintReport(_bstr_t FileName, _bstr_t Filename2)

    {

    m_IDC_VSPRINTER1->LoadDoc(FileName, 1);

    m_IDC_VSPRINTER1->LoadDoc(Filename2, 1);

    m_IDC_VSPRINTER1->PrintDoc();

    }

    I am trying to use SaveDoc function. but document is not opening with this function.

    Could you help me on how to save the merged document on specified location.

    Thank you in Advance.

    Regards,

    Latha

  • Posted 30 April 2020, 1:13 am EST

    Hi Latha,

    Please use VSPdf for the purpose:

    https://help.grapecity.com/componentone/NetHelp/vsview8/vspdfcontrol.html

    It allows you to create and add information to PDF files. You can use its ConvertDocument method to convert the current VSPrinter document into a PDF file:

    https://help.grapecity.com/componentone/NetHelp/vsview8/convertdocumentmethod.html

    Thanks,

    Pragati

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels