How to import the PDFsharp Package?

Hi All,
can you help me how to import pdfsharp package in UiPath and how to convert the Tiff files into pdf
thankyou!!

Hi there,

there are multiple PDF sharp packages available in UiPath, and each one of them contains a link to a GitHub project maybe view the project links to help you decide on which one to install on your projects:

After installing pdf Sharp, the below namespaces should be imported by default into your project if not, you can do that manually:

Imports PdfSharp.Pdf
Imports PdfSharp.Drawing
Imports System.Drawing.Imaging

eg:
image

then you can use invoke code and paste this code in:

' Path to the input TIFF file
        Dim tiffPath As String = "input.tiff"
        ' Path to the output PDF file
        Dim pdfPath As String = "output.pdf"

        ' Create a new PDF document
        Dim document As New PdfDocument()

        ' Load the TIFF image
        Using tiffImage As Image = Image.FromFile(tiffPath)
            ' Get the number of frames (pages) in the TIFF file
            Dim frameCount As Integer = tiffImage.GetFrameCount(FrameDimension.Page)

            ' Iterate through each frame in the TIFF file
            For i As Integer = 0 To frameCount - 1
                ' Select the frame
                tiffImage.SelectActiveFrame(FrameDimension.Page, i)

                ' Create a new PDF page
                Dim page As PdfPage = document.AddPage()
                page.Width = XUnit.FromPoint(tiffImage.Width)
                page.Height = XUnit.FromPoint(tiffImage.Height)

                ' Draw the TIFF image onto the PDF page
                Using gfx As XGraphics = XGraphics.FromPdfPage(page)
                    Dim img As XImage = XImage.FromGdiPlusImage(tiffImage)
                    gfx.DrawImage(img, 0, 0, tiffImage.Width, tiffImage.Height)
                End Using
            Next
        End Using

        ' Save the PDF document
        document.Save(pdfPath)

        ' Output success message
        Console.WriteLine("TIFF file converted to PDF successfully.")

You may also find these links useful: