|
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 = "<div style='text-align:center;font-size:12px;'>{page_number} of {total_pages}</div>",
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!
|
|
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.aspxOnce we have that we will look into it and see what we can find. Thanks!
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
No problem. We will look into it as soon as we receive it.
|
|
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!
|
|
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!
|
|
Rank: Newbie Groups: Member
Joined: 2/18/2019 Posts: 8
|
hmm interesting! I'll try that out. I am using Adobe Acrobat.
thank you!
|
|
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!
|
|