locked
Open multiple documents in web page RRS feed

  • Question

  • User1510859543 posted

    Is there a way to open more than 1 PDF document in an aspx (or html) page and print them as one print?

    Monday, September 30, 2019 1:19 PM

All replies

  • User475983607 posted

    Is there a way to open more than 1 PDF document in an aspx (or html) page and print them as one print?

    No. 

    You'll need to combine the PDFs on the server and let the user download the resulting PDF.

    Monday, September 30, 2019 1:40 PM
  • User1510859543 posted

    Can you point me to an example of merging multiples into one file?  Would I need to stream them somehow?

    Monday, September 30, 2019 1:44 PM
  • User475983607 posted

    Can you point me to an example of merging multiples into one file?  Would I need to stream them somehow?

    Merging PDF files is out-of-scope for an ASP.NET forum.  Google for a PDF API that fits your requirements.

    https://www.google.com/search?rlz=1C1GGRV_enUS812US812&sxsrf=ACYBGNSMOUB9bPiDUVuVK_L1UVUay5LPrw:1569851516176&q=C%23+merge+PDF&sa=X&ved=0ahUKEwjU3uLP2PjkAhXhRd8KHRQPBhQQ7xYILygA&biw=1920&bih=1057

    Monday, September 30, 2019 1:52 PM
  • User288213138 posted

    Hi dlchase,

    dlchase

    open more than 1 PDF document in an aspx (or html) page

    I made demo for your as a reference, I open multiple files on multiple windows.

    protected void Button1_Click(object sender, EventArgs e)
            {
                DirectoryInfo objDir = new DirectoryInfo(Server.MapPath("~/Doc/"));
                FileInfo[] objFI = objDir.GetFiles("*.pdf"); 
                int iFileCnt = 0; 
    
                if (objFI.Length > 0)
                {
    
                    foreach (FileInfo file in objFI)
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Popup_File" + iFileCnt, "window.open('https://localhost:44330/Doc/" + objFI[iFileCnt].Name + "','_blank');", true);
                        iFileCnt += 1;
                    }
                }       
            }

    The result:

    dlchase

    print them as one print?

    You can try to use iText to merge the pdf. About how to merge multiple pdf files you can refer to this link: https://stackoverflow.com/a/15945467

    Best regards,

    Sam

    Tuesday, October 1, 2019 7:30 AM