Welcome Guest Search | Active Topics | Sign In | Register

Adding a new page to an existing PDF Options
jamez
Posted: Monday, September 16, 2019 2:27:08 PM
Rank: Newbie
Groups: Member

Joined: 9/16/2019
Posts: 2
Hi, I've followed the basic example code here:


Code: Visual Basic.NET
'Load the file
Dim doc As New PdfDocument(pdfFileName)

'Append a new page
Dim page As PdfPage = doc.Pages.Add()

'Render contents on the new page
HtmlToPdf.ConvertHtml("Text on the new page.", page)

'Save it to a new file
doc.Save(newFileName)


When this code trys to run the line: HtmlToPdf.ConvertHtml("Text on the new page.", page)

I get the following error:
An exception of type 'EO.Pdf.HtmlToPdfException' occurred in [...dll] but was not handled in user code

Additional information: Conversion failed. Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

Why would this simple code not work?
eo_support
Posted: Monday, September 16, 2019 2:39:29 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

We tested your code here and it works fine here. So the issue might have to do with the existing PDF file that you are trying to load. You can send us the PDF file in question and we will be happy to look into it and see what we can find. See here for more information on how to send test file to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
eo_support
Posted: Wednesday, September 18, 2019 12:21:16 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

We tested your file with your code here and it still works fine. What version do you use? Can you try the latest build and see if it works for you?

Thanks!
jamez
Posted: Wednesday, September 18, 2019 1:38:46 PM
Rank: Newbie
Groups: Member

Joined: 9/16/2019
Posts: 2
Hi, this has been resolved as of yesterday. There was a line of code blocking access to the local file system which was causing the error.

Thanks
eo_support
Posted: Wednesday, September 18, 2019 2:49:36 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
OK. Glad to hear that it's working for you.


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.