cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate Multiple PDF files ?

Former Member
0 Kudos

Dear Experts ,

I need to generate multiple PDF on single button click . I am passing Account Code as parameter , for 1 account code we have multiple sub ledger .

I need to group by Account code wise and sub ledger wise,so I am using Group expert formula and I selected new page after 1 visible group .

If I have 10 sub ledger , I have 10 pages of record in single PDF .

Instead of this I need to generate 10 page as separate PDF (like 10 pop up ) , is it possible to generate using sap crystal report and Visual studio 2010 vb.net?

If it is possible I need to send sub ledger wise mail to customer .

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

You have a couple of options:

1.  There are third-party tools that will do this.  www.kenhamady.com/bookmarks.html is a good place to start looking for these.

2.  Redesign your report so that you have a parameter for each page or a separate report for each page.  Then write code that will walk through and export each of them separately.

-Dell

Answers (1)

Answers (1)

ido_millet
Active Contributor
0 Kudos

At least one of the 3rd-party Crystal Reports desktop schedulers (see list at http://kenhamady.com/bookmarks.html) allows you to do this using single-pass bursting.  That tool offers a full command line API, so you could call it from within your .net code.

0 Kudos

Or export a single page to PDF format.

Just set the page range in code and loop through it 10 times.

You can use the SaveDataController to filter each loop also.

Multiple ways to do this...

Simple export setting page range to PDF.

private void Export_Click(object sender, EventArgs e)

{

    CrystalDecisions.Shared.PdfRtfWordFormatOptions pdfOpts = CrystalDecisions.Shared.ExportOptions.CreatePdfRtfWordFormatOptions();

    CrystalDecisions.Shared.ExcelDataOnlyFormatOptions excelOptsDataOnly = CrystalDecisions.Shared.ExportOptions.CreateDataOnlyExcelFormatOptions();

    CrystalDecisions.Shared.ExcelFormatOptions excelOpts = CrystalDecisions.Shared.ExportOptions.CreateExcelFormatOptions();

    CrystalDecisions.Shared.MicrosoftMailDestinationOptions mailOpts = CrystalDecisions.Shared.ExportOptions.CreateMicrosoftMailDestinationOptions();

    CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = CrystalDecisions.Shared.ExportOptions.CreateDiskFileDestinationOptions();

    CrystalDecisions.Shared.ExportOptions exportOpts = new CrystalDecisions.Shared.ExportOptions();

    CrystalDecisions.Shared.PdfFormatOptions PDFExpOpts = new CrystalDecisions.Shared.PdfFormatOptions();

    //CrystalDecisions.Shared.HTMLFormatOptions HTMLExpOpts1 = new CrystalDecisions.Shared.HTMLFormatOptions();

    CrystalDecisions.Shared.HTMLFormatOptions HTMLExpOpts = CrystalDecisions.Shared.ExportOptions.CreateHTMLFormatOptions();

    CrystalDecisions.Shared.ExchangeFolderDestinationOptions ExchExpOpts = new ExchangeFolderDestinationOptions();

    CrystalDecisions.Shared.TextFormatOptions TxtExpOpts = new TextFormatOptions();

    CrystalDecisions.Shared.CharacterSeparatedValuesFormatOptions csvExpOpts = new CrystalDecisions.Shared.CharacterSeparatedValuesFormatOptions();

    //CrystalDecisions.Shared.ExchangeDestinationType ExchExpType = new ExchangeDestinationType();

    CrystalDecisions.ReportAppServer.ReportDefModel.HTMLExportFormatOptions RasHTMLExpOpts = new HTMLExportFormatOptions();

    CrystalDecisions.ReportAppServer.ReportDefModel.TextExportFormatOptions txtFmtOpts = new TextExportFormatOptions();

    //CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions TxtExpOpts = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();

    CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions RASexportOpts = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();

    CrystalDecisions.ReportAppServer.ReportDefModel.CharacterSeparatedValuesExportFormatOptions RASCSVExptOpts = new CharacterSeparatedValuesExportFormatOptions();

    CrystalDecisions.ReportAppServer.ReportDefModel.PDFExportFormatOptions RasPDFExpOpts = new PDFExportFormatOptions();

    CrystalDecisions.ReportAppServer.ReportDefModel.DataOnlyExcelExportFormatOptions RasExcelOpts = new DataOnlyExcelExportFormatOptions();

    reportDocument.Load("TestReport.rpt");

    rptClientDoc = rpt.ReportClientDocument;

    RASexportOpts.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatPDF;

    RasPDFExpOpts.CreateBookmarksFromGroupTree = true;

    RASexportOpts.FormatOptions = RasPDFExpOpts;

    // Create a loop here

    RasPDFExpOpts.StartPageNumber = 1;

    RasPDFExpOpts.EndPageNumber = 1;

    RasPDFExpOpts.CreateBookmarksFromGroupTree = true;

    string MyRptName = rpt.FileName.ToString();

    MyRptName = MyRptName.Substring(MyRptName.LastIndexOf(@"\") + 1, (rpt.FileName.Length - 3) - (MyRptName.LastIndexOf(@"\") + 1)) + "pdf";

    rptClientDoc.PrintOutputController.ExportEx(RASexportOpts).Save(@"D:\Atest\" + MyRptName, true);

}

Don