HTMLFragment that spans multiple pages results in several issues with links

When you create a PDF file from HTML, which ends up spanning multiple pages once converted there are several issues.

All hyperlinks - which end up as link annotations, are present in all page objects, not just the pages containing them.

The rect’s and location of the link annotations no longer match there actual location on the page. This behavior does not occur when the HTMLFragment only creates a single page.

@nserror

Thank you for contacting support.

Would you please share both HTML files, respective PDF files along with a narrowed down code snippet reproducing this issue so that we may try to reproduce and investigate it in our environment.

HTML Code

<a href='http://www.google.com'>Link one</a><br><a href='http://www.google.com'>Link two</a><br><a href='http://www.google.com'>Link three</a><br><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p><p>Hello world!!</p>

The HTML code above creates a 2 page PDF, with the link annotations in the wrong location. Removing the last

tag from the above HTML results in a 1 page PDF with correctly placed link annotations.

Here is the code used to generate the PDF

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
            Page page = doc.Pages.Add();
            //setting page size to match letter instead of A4.
            page.SetPageSize(610.997, 790.702);
            HtmlFragment html = new HtmlFragment(htmlString);
            page.Paragraphs.Add(html);

            //set margins
            var marginInfo = new MarginInfo();
            marginInfo.Left = 40;
            marginInfo.Right = 40;
            marginInfo.Top = 40;
            marginInfo.Bottom = 40;

            page.PageInfo.Margin = marginInfo;
            
            MemoryStream dstStream = new MemoryStream();
            doc.Save(dstStream, Aspose.Pdf.SaveFormat.Pdf);
            var fileModel = new FileModel
            {
                data = dstStream.ToArray(),
                contentType = "application/pdf"
            };
            return fileModel;

Attached is 2 pdf files, with rects drawn around the resulting link annotations. Clearly the link annotations are in the absolute wrong place whenever the PDF ends up being greater than 1 page.

BrokenPDF.pdf (37.6 KB)
CorrectPDF.pdf (35.9 KB)

@nserror

Thank you for sharing requested data.

We have been able to reproduce the issue in our environment. A ticket with ID PDFNET-45094 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Great news! Do you have any type of estimated time frame until a fix will become available?

@nserror

The issue has recently been logged in our issue management system and will be investigated on its due turn, which can take several months owing to large number of previously logged tickets. We appreciate your patience and comprehension in this regard.

However, we also offer Paid Support, where issues are used to be investigated with higher priority. Our customers, who have paid support subscription, report their issue there which are meant to be investigated urgently. In case your reported issue is a blocker, you may please consider subscribing for Paid Support. For further information, please visit Paid Support FAQs.

Can I get an update on this issue? It has been over 5 months.

@nserror

Thank you for being patient.

We are afraid this ticket is still pending for investigations. We have recorded your concerns and will let you know as soon as some significant updates will be available in this regard.

I have a similar issue in the latest version of Aspose.
Is the ticket still pending?

@ATC1

Regretfully, the ticket is pending for a resolution. However, we have recorded your concerns and will surely update you as soon as the ticket gets resolved. Please give us some time.

We are sorry for the inconvenience.

Hi @asad.ali

Is there update on this issue? If not would you be able to give me an estimate of when this issue will be looked at?

We have encountered the same issue in our test and production environments and it is causing us a potential major issue. I am concerned that this issue wont be fixed anytime soon as it has been logged as an issue since July 2018.

Looking forward to hearing from you.

Thanks,

Chris

@cbparl

The issue was logged under free support model where issues are resolved on first come first serve basis. Sadly, the earlier logged ticket could not get resolved due to other pending issues in the queue. However, we have recorded your concerns and will surely consider them during ticket investigation. We will provide an update in this forum thread once we have some news about issue fix or ETA. Please spare us some time.

We apologize for the inconvenience.