We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Hyperlinks in DocToPDFConverter

Hi,

Im having an issue with converting hyperlinks from a Word docx to PDF.

It seems to be if the text begins with "http://" or "www.", it will be converted to a hyperlink in the PDF.  If you have chosen to create a hyperlink in Word with custom text (eg. "Google" with a hyperlink to "http://www.google.com"), this is not being converted to a hyperlink in the PDF.

Here are the examples and results:

SUCCESS: http://www.google.com (plain text)

SUCCESS: www.google.com (plain text)

FAIL: maps.google.com (plain text)

FAIL: google.com (plain text)

SUCCESShttp://www.google.com (hyperlinked)

SUCCESSwww.google.com (hyperlinked)

FAILGoogle (hyperlinked)

FAILGoogle (hyperlinked)

I have tested this with http://asp.syncfusion.com/demos/reporting/Pdf/Import%20and%20Export/DoctoPDF/cs/DoctoPDF.aspx and get the same results.

Code im using is below, word document has been attached.

                using (MemoryStream stream = new MemoryStream(wordDocBytes))
                {
                    WordDocument wordDoc = null;
                    wordDoc = new WordDocument(stream, FormatType.Docx);

                    //Initialize chart to image converter for converting charts in word to pdf conversion
                    wordDoc.ChartToImageConverter = new ChartToImageConverter();
                    wordDoc.ChartToImageConverter.ScalingMode = Syncfusion.OfficeChart.ScalingMode.Normal;

                    DocToPDFConverter converter = new DocToPDFConverter();
                    //Convert word document into PDF document
                    PdfDocument pdfDoc = converter.ConvertToPDF(wordDoc);
                    using (MemoryStream outputStream = new MemoryStream())
                    {
                        pdfDoc.Save(outputStream);
                        pdfBytes = outputStream.ToArray();
                    }
                    pdfDoc.Close(true);
                    wordDoc.Close();
                }

Thanks

Anthony

Attachment: Hyperlink_test_ee3992f4.7z

3 Replies

SY Sethumanikkam Yogendran Syncfusion Team July 18, 2016 10:36 AM UTC

Hi Anthony,

Thank you for contacting Syncfusion support.

We have already fixed the mentioned Hyperlink issue in Word to PDF conversion in our latest version. You can download our volume 2, 2016 release from the below link.
https://www.syncfusion.com/forums/124709/essential-studio-2016-volume-2-release-v14-2-0-26-is-available-for-download

Please refer the following link for Word to PDF conversion sample.
http://asp.syncfusion.com/demos/web/docio/doctopdf.aspx

Thanks,
Sethumanikkam.Y
 



UN Unknown Syncfusion Team July 18, 2016 01:37 PM UTC

Thank you.

I have updated and all is working as it should.

Thanks again for your help.

Anthony


SY Sethumanikkam Yogendran Syncfusion Team July 19, 2016 03:50 AM UTC

Hi Anthony,

Thank you for your update.

Please let us know if you have any other questions. We will be happy to assist you as always.

Thanks,
Sethumanikkam.Y


Loader.
Up arrow icon