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

PDF from url

Thread ID:

Created:

Updated:

Platform:

Replies:

108341 Apr 15,2013 12:50 PM UTC Apr 24,2013 04:57 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: PDF
Prakash Makhija
Asked On April 15, 2013 12:50 PM UTC

Hello,

I have to create a PDF from url and i am using the code from help document

here is the code:

//Create a new PDF document.

PdfDocument document = new PdfDocument();

//Creates a new page and adds it as the last page of the document.

PdfPage page = document.Pages.Add();

//Create a new pdf textweblink annotation

PdfTextWebLink webLinkAnnotation = new PdfTextWebLink();

webLinkAnnotation.Url = "http://www.yahoo.com";

webLinkAnnotation.DrawTextWebLink(page, new PointF(50, 40));

//Add this annotation to a new page.

page.Annotations.Add(webLinkAnnotation);

//Save the document to disk.

document.Save("TextWebLink(.pdf");

I am getting an error on line

page.Annotations.Add(webLinkAnnotation);

and the error is "The best overloaded method match for 'Syncfusion.Pdf.Interactive.PdfAnnotationCollection.Add(Syncfusion.Pdf.Interactive.PdfAnnotation)' has some invalid arguments"

Can you please help me resolve this issue?

thanks


Praveenkumar H [Syncfusion]
Replied On April 18, 2013 10:22 AM UTC

Hi Prakash,

Thank you for using Syncfusion products,

Please use the below code to create web link in the PDF

            PdfDocument document = new PdfDocument();
            //Creates a new page and adds it as the last page of the document.
            PdfPage page = document.Pages.Add();
            //Create a new pdf textweblink annotation
            PdfTextWebLink webLinkAnnotation = new PdfTextWebLink();
            webLinkAnnotation.Url = "http://www.yahoo.com";
            webLinkAnnotation.Text = "Click to go Yahoo";

            webLinkAnnotation.Font = new PdfTrueTypeFont(new Font("Arial", 12));
            webLinkAnnotation.Pen = PdfPens.Brown;
            webLinkAnnotation.DrawTextWebLink(page, new PointF(50, 40));

            //Add this annotation to a new page.

            //Save the document to disk.
            document.Save("TextWebLink.pdf");

The sample project is attached for your reference.

Please let us know if you have any concern.

With Regards,
Praveen



PDF Text web Link_2708d032.zip

Prakash Makhija
Replied On April 22, 2013 12:54 PM UTC

Thanks,

One more question

document.save() option save the pdf file on the same folder in which i have my c# file, I want to open the save dialogue box and allow user to select the path on his machine to save the pdf

Is it possible in syncfusion?

 


Praveenkumar H [Syncfusion]
Replied On April 24, 2013 04:57 AM UTC

Hi Prakash,

Thank you for your update,

We can save the PDF file in the user defined path by using the SaveFileDialog.
We have attached the sample project for your reference.

Please let us know if you have any concern.

With Regards,
Praveen


Saving the PDF_b361cabb.zip

CONFIRMATION

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.

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

;