Error: Invalid orgin paragraph in Insert method

Aspose.Pdf file version: 4.6.0.0, product version: 2010.08.01

Run following code, you will get error: "Invalid orgin paragraph in Insert method". Please let me know the workaround, since it may take a while for you to put the fix in a release. Thanks.

Here is the source code:

using System;
using System.Collections.Generic;
using System.Text;
using Aspose.Pdf;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
string html = "

This is a testfile:

 \"tibco.png\"

";
Pdf pdf = new Pdf();
Section section = pdf.Sections.Add();
Text t = new Text(html);
t.IsHtmlTagSupported = true;
section.Paragraphs.Add(t);

// error: Invalid orgin paragraph in Insert method
pdf.Save("c:\\temp\\out.pdf");
}
}
}

Hello Tony,

I have tested the scenario and I’m able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFNET-19891. I am afraid until or unless we have analyzed this issue, we might not be able to share any workaround. Please be patient and spare us little time. We will get back to you, soon.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.

Since there is no workaround available, could you please set it as a high priority one, so the fix can come sooner? Thanks.

Hello Tony,

As I have already shared, please spare us little time so that we can figure out the actual reasons of this problem. Once we have analyzed it properly, we might be able to share some workaround. Until then, please be patient and spare us little time.

We are sorry for the delay and inconvenience.

Thanks. When you get it back, please post it here, so I can get email notified.

I’ve been receiving this error as well, are there any forthcoming fixes? And is the error meant to be “origin paragraph” or is “orgin paragraph” a part of a pdf?

Hi,

Thanks for using our products.

Can you please share the code snippet that you are using? as it will help us to correct the problem in this scenario as well. We are sorry for your inconvenience.

I was able to work around this problem by eliminating an image that had been at the top of the page, here’s the code that gave the problem, and a description of additional problems I’ve run into.

Dim pdf As New Aspose.Pdf.Pdf()
Dim text As Aspose.Pdf.Text
Dim section As New Aspose.Pdf.Section()
text = New Aspose.Pdf.Text(html)
text.IsHtmlTagSupported = True
section.Paragraphs.Add(text)
pdf.Sections.Add(section)

filename = "meeting.pdf"

pdf.Save(filename, SaveType.OpenInAcrobat, Response)

I’ve attached the html, which is coming in as a string. I put a note in it so you could see where the image was that appears to have been causing the problem.

However, I’ve come across two additional problems - for some reason any backcolor I have seems to become black rather than the color it should be. To try to get around this, I wrote some code to replace all back-color properties with a border, but I’m now getting “Index was outside the bounds of the array” with correct html.

I’ve attached the full error description and stack trace as well.

Okay, I’ve been able to solve some problems - the background color problem was that it was not correctly interpreting colors in RGB style (i.e. “color: rgb(75,50,100)”) so I had to replace them with hex values. I still can’t get an image into the pdf though. Still not sure what was going on with the border problem, but I’m not getting that error any more now that I can use background color.

Hi,

I have tested the scenario where I have replaced the Image tag with Hex values and have placed an image on top of the HTML page and when I have converted HTML page into PDF format, I am unable to notice the problem and the image is also being displayed. Please take a look over the attached updated document and the resultant PDF that I have generated with Aspose.Pdf for .NET 4.6.0.

In case you still face any problem, please feel free to contact. We apologize for your inconvenience.