Developer Programs

Learn

Docs

OpenPDF

API Reference > OpenPDF
SoapActionn/a
Input NameOpenPDF
Output NameOpenPDFResponse
Input Namespacen/a
Group NameXperience
ContainerXP_MsgBus.xsd
OpenPDF.cs
private void ButtonLoadPdf_Click(object sender, RoutedEventArgs e)
{
    string basePath = Assembly.GetExecutingAssembly().Location;
    basePath = Path.GetDirectoryName(basePath);

    string fileLocation = Path.Combine(basePath, "Pdf", "Sample");
    fileLocation = Path.ChangeExtension(fileLocation, ".pdf");

    // PDFLoc: The location to the PDF:
    //    Local File: C:/Folder1/Sub-Folder1/TEST.PDF
    //    Remote File: https://somewebsite.com/Documents/TEST.PDF
    // PDFDoc: The actual (encoded) PDF file itself.
    // ParentId: The product's main application window handle that will be the parent of the new
    //    child window. The new child window's ID will be in the response message.
    // TitlebarTxt: Custom titlebar text for the new tab.
    //    If not supplied, the Title from PDF's details will be used.  If that cannot be found,
    //    "PDF" will show.
    // TitlebarVectorImgCode: The name of a vector image from the WPF controls to use for the child
    //    tab’s icon.
    // TitlebarIcon: A base64 encoded byte array of a bitmap image to use for the child tab’s icon.
    //    If neither the TitlebarIcon nor TitlebarVectorImgCode are supplied, the AdobePDF vector
    //    icon will be used.

    OpenPDFRq_MType message = new OpenPDFRq_MType()
    {
        ParentId = XperienceContext.Current.WindowManager.MainHostedWindow.WindowId,
        PDFLoc = fileLocation,
        PrtButEnabled = bool.TrueString,
        SaveButEnabled = bool.TrueString,
        SaveButTxt = "Click to update records",
        TitlebarTxt = "Please update user records",
        TitlebarVectorImgCode = JackHenry.Enterprise.Controls.Wpf.Common.JhaImageTypes.Account.ToString()
    };

    ICallback context = this.messageBus
                            .Send(message)
                            .RegisterResponseHandler(this.OpenPDFCallback);

    if (!context.Receipt.IsValid())
    {
        string error = MessageHelper.CollectionErrors(context.Receipt.Errors);
        this.DisplayOutput(error);
    }
    else
    {
        this.DisplayOutput(
            string.Concat("OpenPDF Message Receipt ID: ", context.Receipt.MessageId));
    }
}

Did this page help you?

Last updated Mon Dec 9 2024