Changing font color in PDF document

We need to change font color of whole PDF document especially any mailto: blue color.
When i tried following code , it works but some document change to full black.

    Using document As Document = New Document(filepath)
        Dim strategy As Aspose.Pdf.RgbToDeviceGrayConversionStrategy = New Aspose.Pdf.RgbToDeviceGrayConversionStrategy()
        For idxPage As Integer = 1 To document.Pages.Count
            ' Get instance of particular page inside PDF
            Dim page As Page = document.Pages(idxPage)
            ' Convert the RGB colorspace image to GrayScale colorspace
            ' page.MakeGrayscale()
            strategy.Convert(page)
        Next
        'Save resultant file
        document.Save(filepath)
    End Using

When i tried following code to change only font color, hyperlink blue color does not change

Using pdfDocument As Aspose.Pdf.Document = New Aspose.Pdf.Document(filepath)

        For idxPage As Integer = 1 To pdfDocument.Pages.Count

        Next
        Dim ta As Aspose.Pdf.Text.TextFragmentAbsorber = New Aspose.Pdf.Text.TextFragmentAbsorber()

        For Each tf As Aspose.Pdf.Text.TextFragment In ta.TextFragments
            tf.TextState.ForegroundColor = Aspose.Pdf.Color.Black
        Next

        pdfDocument.Save(filepath)
    End Using

WE NEED IMMEDIATE HELP, SO Please help US

@mclement.jud6.org

Hyperlink’s blue color will not change in the PDF file. Please share your source file, generated PDF and desired output. We will be able to investigate that on our end on provision of requested information.

The source code is as below . All documents work fine. Some documents make whole page black except images. I am using latest ASPOSE.PDF dll and the lic which i have in my profile. On the file, i need to check if i can share as it is confidential.

Please let me know how can i share the file.

Dim pdfDocument As Aspose.Pdf.Document = New Aspose.Pdf.Document(filepath)

    For Each ipage As Aspose.Pdf.Page In pdfDocument.Pages
        ipage.Background = Aspose.Pdf.Color.White
    Next

    Dim tfa As Aspose.Pdf.Text.TextFragmentAbsorber = New Aspose.Pdf.Text.TextFragmentAbsorber()
    pdfDocument.Pages.Accept(tfa)
    Dim tfc As Aspose.Pdf.Text.TextFragmentCollection = tfa.TextFragments

    For Each tf As Aspose.Pdf.Text.TextFragment In tfc
        tf.TextState.ForegroundColor = Aspose.Pdf.Color.Black
    Next

    pdfDocument.Save(filepath)

We are experiencing IIS Worker process memory issue to. Is this related to the color conversion

How can i attach the file

@mclement.jud6.org

You can upload the file in this thread by using upload button. If the files sizes are above 9 MB, you can then upload on some file server and share download link with us. image.png (7.7 KB)