How to join several pdf in 1 single

0

I have the following problem, I am trying to join several pdf files in 1, I have a pdf url list and the idea is to mix them in one.

I try this:

The string list has:

http://dlls.medezweb.com/resources/432714927725926.pdf
http://dlls.medezweb.com/resources/432318982047222.pdf
http://dlls.medezweb.com/resources/432365550934607.pdf

And the outfile variable has:

C:/inetpub/wwwroot/dlls.medezweb.com/resources/notegeneratedbyprint.pdf

Here my code:

public void UnirListaPdf(List<String> InFiles, String OutFile)
    {
        using (FileStream stream = new FileStream(OutFile, FileMode.Create))
        using (Document doc = new Document())
        using (PdfCopy pdf = new PdfCopy(doc, stream))
        {
            doc.Open();

            PdfReader reader = null;
            PdfImportedPage page = null;
            InFiles.ForEach(file =>
            {
                reader = new PdfReader(file);
                for (int i = 0; i < reader.NumberOfPages; i++)
                {
                    page = pdf.GetImportedPage(reader, i + 1);
                    pdf.AddPage(page);
                }
                pdf.FreeReader(reader);
                reader.Close();
                File.Delete(file);
            });
        }

This produces the following error:

  

URI formats are not supported

    
asked by Raidel Fonseca 21.06.2018 в 23:24
source

0 answers