Welcome Guest Search | Active Topics | Sign In | Register

Error in Merging multiple pdf files Options
poorni
Posted: Wednesday, May 21, 2014 12:33:07 PM
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.
eo_support
Posted: Wednesday, May 21, 2014 12:55:46 PM
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!
poorni
Posted: Wednesday, May 21, 2014 1:48:39 PM
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.

eo_support
Posted: Wednesday, May 21, 2014 2:55:46 PM
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!
poorni
Posted: Wednesday, May 21, 2014 3:11:51 PM
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()))
eo_support
Posted: Wednesday, May 21, 2014 3:22:26 PM
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.aspx

Thanks!
eo_support
Posted: Thursday, May 22, 2014 3:40:48 PM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.