Welcome Guest Search | Active Topics | Sign In | Register

Issue with appending to URLs in Html Options
Carl De
Posted: Monday, February 18, 2019 5:41:49 PM
Rank: Newbie
Groups: Member

Joined: 2/18/2019
Posts: 8
My html contains a link to our website. The html comes out correctly. However when converted to pdf, it appends a word to the link.

Specifically, in the English version the link will show correctly as https://www.myco.com/terms-and-conditions, but when you click it it will attempt to go to https://www.myco.com/terms-and-conditionsInvoice. In spanish it will go to https://www.myco.com/terms-and-conditionsFactura.

The only place I can see where it would get that value is from this:
Code: HTML/ASPX
<div class='col-xs-4 text-center'>
      <h1 class='page-title'>Factura</h1>
    </div>


But WHY would it be appending to the url link? It is not showing up that way in the text of the document? (pdf or html)


This is the code that I am calling to convert my html

Code: C#
MemoryStream pdfStream = new MemoryStream();

            HtmlToPdfOptions options = new HtmlToPdfOptions()
            {
                FirstPageNumber = 1,
                FooterHtmlFormat = "&lt;div style='text-align:center;font-size:12px;'&gt;{page_number} of {total_pages}&lt;/div&gt;",
                OutputArea = new RectangleF(0.5f, 0.5f, 7.5f, 10f),
                PageSize = new SizeF(8.5f, 11f),
                UsePrintMedia = true,
            };
            HtmlToPdf.ConvertHtml(fileHtml, pdfStream, options);


Here is a snippet from the html:

Code: HTML/ASPX
<div class='text-center fine-print'>
    <div>My Company Address</div>
    Deposit of a check for less than full amount of this invoice shall not constitute an accord and satisfaction, nor a full settlement of this
    invoice, without prior written agreement. All transportation services will be subject to the terms and conditions set forth on the following
    link (please take the time to carefully review these legal terms and conditions): https://www.myco.com/terms-and-conditions
  </div>



Please advise. Thank you!
eo_support
Posted: Monday, February 18, 2019 10:03:49 PM
Rank: Administration
Groups: Administration

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

This does not make any sense. The converter won't somehow make up some Url that happens to match some word in your HTML. It has to come from your HTML, most likely from some JavaScript code in your HTML. You can try to isolate the problem into a test HTML file, then comment out block by block to see if you can find out the triggering part. If you have gone through that and still can not find out why, you can try to create a test project to duplicate the problem and send the test project to us. See here for more details:

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

Once we have that we will look into it and see what we can find.

Thanks!
Carl De
Posted: Tuesday, February 19, 2019 9:09:24 AM
Rank: Newbie
Groups: Member

Joined: 2/18/2019
Posts: 8
I agree it makes absolutely no sense. There is no javascript in the html at all.

I will create a test project, and go from there.
eo_support
Posted: Tuesday, February 19, 2019 10:16:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
No problem. We will look into it as soon as we receive it.
Carl De
Posted: Tuesday, February 19, 2019 11:48:23 AM
Rank: Newbie
Groups: Member

Joined: 2/18/2019
Posts: 8
I just sent the email. However it looks like my mail server may have stripped off the project. There were 3 attachments, html.zip, pdf.zip and CHRInvoicingEOTestSolution.zip.

Please let me know if any/all were received.

thanks!
eo_support
Posted: Tuesday, February 19, 2019 12:05:01 PM
Rank: Administration
Groups: Administration

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

What PDF Viewer application do you use? These are in fact NOT links. These are plain text. It appears that your PDF Viewer application tries to automatically interpret plain text that "looks like" links but may not have interpreted it correctly.

The "true" link are A element in your HTML, such as:

Code: HTML/ASPX
<a href="https://www.myco.com/terms-and-conditions">https://www.myco.com/terms-and-conditions</a>


This is the kind of link that the HTML to PDF converter will recognize and process and in that case, the target Url is explicitly specified through the href attribute. If you wish to ensure the link are interpreted correctly, you should use A element instead.

Simple text that "looks" a link often do not get interpreted correctly in PDF file because PDF file is like a canvas. It contains information such as draw this here and and draw that there, some PDF file may not even contain information about the actual letters that it is "drawing". So you should avoid relying on this and use A element instead.

Thanks!

Carl De
Posted: Tuesday, February 19, 2019 12:09:05 PM
Rank: Newbie
Groups: Member

Joined: 2/18/2019
Posts: 8
hmm interesting! I'll try that out. I am using Adobe Acrobat.

thank you!
Carl De
Posted: Tuesday, February 19, 2019 12:29:50 PM
Rank: Newbie
Groups: Member

Joined: 2/18/2019
Posts: 8
Yes that did indeed work, sort of.

That format repeated the link. I changed it to this. <a href="https://www.myco.com/terms-and-conditions"></a> which does work.

It does, however, a () around the link. But hey, it works.

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.