SSRS Export to separate pdfs

  • Hi everyone, can anyone tell me the process of how to create multiple pdf's from an SSRS report ? Each pdf should refer to one student . Thank you.


    I tried doing data driven expressions , but got stuck with the "File name, Path, Render Format, Write mode, File Extension, User name, Password, Use file share account" format.

    However i am happy to use SSIS package if there is a way.


    Thank you.

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Does your SSRS report display results for just one student and you need to run the report again for each student? If so, I may have a solution for you.

    If you have a report that spits out multiple students and you want to break it up, that is going to be alot harder, I think.

  • Thank you for replying. I have an SSRS report which when exported to PDF has all the list of students. But I want to split them up as per their IDS with first name and last name.

  • I think the cleanest option, if it is an option for you, would be to create a new report that only presents data for one student, and then make calls to programmatically generate the individual reports. Assuming that's not an option, then hopefully this at least gives you some ideas or even works for you.

    My initial assumptions are that the large report is one page per student and there is some text on the page that you can find to identify the student. There are ways to get N pages if the section for a student is always N pages. But with assumptions like these you are more likely to run into, yes, that's true except when...

    This code example leverages PowerShell and the PSWritePDF module.

    Install-Module PSWritePDF -Force

    In my code example, I have a report where I am looking for the text "Page" and the first line feed character after that.

    $OriginalPdfFolder = 'C:\temp\PdfSplitTest'
    $OriginalPdf = 'MyPdfFile.pdf'
    $OutputFolder = "$OriginalPdfFolder\Output"

    # Create output folder if it does not exist
    If (-Not (Test-Path $OutputFolder))
    New-Item -ItemType Directory -Force -Path $OutputFolder

    # This creates a PDF for each page in the report and names it generically OutputDocumentN.pdf where N is a number
    Split-PDF -FilePath "$OriginalPdfFolder\$OriginalPdf" -OutputFolder "$OutputFolder"

    # Get the list of files in the output folder
    $files = Get-ChildItem -Path $OutputFolder

    # Loop through the files
    ForEach ($file in $files) {
    $pageText = Convert-PDFToText -FilePath "$OutputFolder\$file"

    $searchTextStart = 'Page'
    $searchTextEnd = [char]10

    $start = $pageText.IndexOf($searchTextStart)
    If ($start -ge 0) {
    $start = $start + $searchTextStart.Length

    $end = $pageText.IndexOf($searchTextEnd, $start)

    if ($end -gt $start) {
    $snippet = $pageText.Substring($start, $end - $start).Trim()

    # Rename the file with the text snippet that has been found
    Rename-Item -Path "$OutputFolder\$file" -NewName "$OutputFolder\$snippet.pdf"


    # Rename the file to say the code worked on it and did not find the text
    Rename-Item -Path "$OutputFolder\$file" -NewName "$OutputFolder\NotFound_$file"


Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply