|
Rank: Newbie Groups: Member
Joined: 5/21/2014 Posts: 5
|
Dim docList As New List(Of PdfDocument)() For Each folder In Directory.GetDirectories(sharepath) fileentries = Directory.GetFiles(folder) For Each fileName In fileentries If fileName.Contains(".pdf") Then docList.Add(New PdfDocument(fileName.ToString())) End If Next Next Dim mergedDoc As PdfDocument = PdfDocument.Merge(docList.ToArray()) mergedDoc.Save(sharepath & "print.pdf")
I got Index out of range error in this code while adding the file to doclist. Could you please help me out in this issue.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
Your code looks fine. You will want to find out exactly on which file it fails, and when it fails, get the exception stack trace and post the stack trace. We will then see what we can find.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/21/2014 Posts: 5
|
Hi,
Some are generated using htmltopdf.converturl method and
some of the "pdf" files I copied from some other folder to this folder using code.
If I remove those files code is working fine.
If I copy those files again not working.
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
We need you to get the stack trace first in order to look further. That will tell you whether the problem is in your code or in our code. If the problem is in our code, we maybe able to tell you what's wrong right away, or in case we can't we may need you to isolate the problem into a test project or need you to send us test files. But first you have to get the stack trace.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 5/21/2014 Posts: 5
|
This is the stacktrace
at System.ThrowHelper.ThrowArgumentOutOfRangeException() at System.Collections.Generic.List`1.get_Item(Int32 index) at EO.Pdf.Internal.w.b(Int32 A_0) at EO.Pdf.PdfDestination.a(iz A_0, w A_1) at EO.Pdf.PdfDestination.a(iz A_0, ld A_1) at EO.Pdf.Internal.iz..ctor(PdfDocument A_0, ah A_1) at EO.Pdf.PdfDocument..ctor(hi A_0) at EO.Pdf.PdfDocument..ctor(String fileName) at GeneratePDF.Form1.generatepdf() in C:\Documents and Settings\jkeros\Local Settings\Application Data\Temporary Projects\GeneratePDF\Form1.vb:line 99
and this is the code at line99 ::::docList.Add(New PdfDocument(fileName.ToString()))
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, That appears to be a corrupted PDF file or a bug in our code. You can find out the file that it is trying to load and send that file to us. We will try to run it here and if we can reproduce the problem, we should be able to provide you a solution. If you have created the problematic file is with our HTML to PDF converter, we would also want to have the original HTML file that were used to create the PDF file too. That way we can use it to test the HTML to PDF converter if the problem is that the HTML to PDF converter generated an invalid PDF file. Please see here for more information on how to send test files to us: http://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
This is just to let you know that we have posted a new build that should resolve this issue. The root of the problem is one of the PDF file has some invalid data. We have changed our code to be more tolerate so the new build should work with your files. Please check your email for the download location of the new build.
Thanks!
|
|