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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Why does the last link just opens the file location of the pdf ?

Thread ID:





125992 Sep 16,2016 05:00 AM UTC Sep 19,2016 10:46 AM UTC ASP.NET MVC 1
Tags: PDF
Asked On September 16, 2016 05:00 AM UTC

My code

   document.PageSettings.Orientation = PdfPageOrientation.Landscape;
                        PdfPage page = document.Pages.Add();

                        PdfGraphics graphics = page.Graphics;
                        PdfBitmap image = new PdfBitmap(ImageFilenames[i]);

                        float ftImageWidth;
                        float ftImageHeight;
                        float ftPageWidth;
                        float ftPageHeight;

                        float.TryParse(image.Width.ToString(), out ftImageWidth);
                        float.TryParse(image.Height.ToString(), out ftImageHeight);
                        ftPageWidth = page.Graphics.ClientSize.Width;
                        ftPageHeight = page.Graphics.ClientSize.Height;

                        float myWidth = image.Width;
                        float myHeight = image.Height;
                        float shrinkFactor=1.3f;
                        if (myWidth > ftPageWidth)

                            shrinkFactor = myWidth / ftPageWidth;
                            myWidth = ftPageWidth;
                            myHeight = myHeight / shrinkFactor;

                        if (myHeight > ftPageHeight)
                            shrinkFactor = myHeight / ftPageHeight;
                            myHeight = ftPageHeight;
                            myWidth = myWidth / shrinkFactor;

                        graphics.DrawImage(image, (ftPageWidth - myWidth) / 2, (ftPageHeight - myHeight) / 2, myWidth, myHeight);

                        //graphics. = image.Width * 0.3f;
                        //float height = image.Height * 0.3f;

                        PdfTextWebLink textLink = new PdfTextWebLink();

                        string[] nameGesplittet = Path.GetFileNameWithoutExtension(ImageFilenames[i]).Split('#');

                        if (nameGesplittet.Length > 1)
                            graphics.DrawString(Path.GetFileNameWithoutExtension(ImageFilenames[i]), font, PdfBrushes.Red, new PointF(0, 35));

                            textLink.Url = "https://www.google.cz/search?hl=en&site=imghp&tbm=isch&source=hp&q=" + nameGesplittet[1].Trim();
                            textLink.Text = "Google Suche(cz)";
                            textLink.Font = font;
                            textLink.DrawTextWebLink(page, new PointF(0, 65));

                            textLink.Url = "https://translate.google.com/#de/cs/" + nameGesplittet[0].Trim();
                            textLink.Text = "Google translate(deutsch)";
                            textLink.Font = font;
                            textLink.DrawTextWebLink(page, new PointF(0, 95));

                            textLink.Url = "https://translate.google.com/#cs/de/" + nameGesplittet[1].Trim();
                            textLink.Text = "Google translate(tschechisch)";
                            textLink.Font = font;
                            textLink.DrawTextWebLink(page, new PointF(0, 125));


                        Console.WriteLine((i + 1) + ": " + Path.GetFileName(ImageFilenames[i]));

Attachment: links_d936d861.7z

Chinnu Muniyappan [Syncfusion]
Replied On September 19, 2016 10:46 AM UTC

Hi Mvxyc, 
Thank you for contacting Syncfusion support. 

We are not able to reproduce the issue, we have created a sample which we tried to reproduce the issue. Could you please modify the sample to reproduce the issue, it would more helpful for us to investigate further on this. 

Sample link: 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon