We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Inserting a url in image

Hi team,
We are trying to insert a url(any server name) In image and insert that image to the pdf document. Can you please help me out with the code required to do this. Thanks in advance.

@Shashank10

Thank you for contacting support.

We would like to request you to use below code snippet in your environment and then share your kind feedback with us. It adds an image to the page of PDF document while setting a hyperlink to a URL.

    Aspose.Pdf.Image img = new Aspose.Pdf.Image();
    img.File = @"D:\Files\test.jpg";
    img.FixWidth = 200;
    img.FixHeight = 100;

    // Add Hyperlink to the image
    img.Hyperlink = new WebHyperlink("https://aspose.com");

    // Create a new Document Object
    Document doc = new Document();

    // Add image to paragraph collection of added page
    Page page = doc.Pages.Add();
    page.Paragraphs.Add(img);

    // Save the document
    doc.Save(@"D:\Files\ImageWithHyperlink_18.4.pdf");

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

Thanks for sharing.
One more doubt, suppose we have added custom properties to a pdf document and now we want to hide those properties. How to achieve it.

@Shashank10

We would like to request you to always create separate topics for separate inquiries. However, you can Redact certain page region with RedactionAnnotation if you want to remove certain elements from any page of a PDF document.

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

I went through the link shared but could not get a solution for my query.
Here’s explaining once again

Document pdfdoc = new Document (file path);

now i am setting custom properties

pdfdoc.Info.Add(“abc”, “xyz”);

So when i see the pdf document now, these custom properties are there in properties of the document visible.

What can be done to hide it from there?

@Shashank10

Thank you for elaborating it further.

We would like to share with you that you can remove custom properties from a PDF document by using ClearCustomData method as in the line of code below. It clears custom data only, leaving all other predefined values (Title, Author, etc.).

pdfdoc.Info.ClearCustomData();

Please let us know in event of any further query. We will be glad to help you.

Thanks for sharing but i think this is just clearing the data and not hiding it. I need to hide the data. How to do that?

@Shashank10

We would like to share with you that Aspose.PDF API mimics the behavior of Adobe Acrobat, so please share if you are able to hide custom properties of a PDF file using Adobe Acrobat. Kindly share such PDF document generated by Adobe Acrobat while mentioning the steps to achieve your requirements so that we may investigate further to help you out.