使用Xamarin Forms应用程序中的图像打印html

问题描述 投票:0回答:1

我正在构建Xamarin Forms应用程序,该应用程序必须能够通过iPad上的Airprint在标签打印机上打印名称标签,但是在从真实设备上打印时,图像空白。标签是一个相当简单的HTML字符串,其中嵌入了base64编码的图像:

<html style="height: 100%">
    <body style="height: 100%; margin: 0">
        <div style="height: 100%; display: flex; flex-direction: column; justify-content: space-between">
            <div style="display: flex; justify-content: space-between">
                <span style="font-size: x-large">VISITOR</span>
                <span><img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQICAQECAQEBAgICAgICAgICAQICAgICAgICAgL/2wBDAQEBAQEBAQEBAQECAQEBAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL/wAARCABNAGQDAREAAhEBAxEB/8QAHQAAAgMBAAMBAAAAAAAAAAAACQoABwgGAQQFAv/EADIQAAEEAwEAAQMCBQIGAwAAAAUDBAYHAQIICQAREhMUFQoWFyExIiMYQVhhmNYkM0L/xAAUAQEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AKjg11d6w9nXZXUO6JkdFUjUW89fiRgQzaYuOx2DRC97W5pr9ZaJ0tbkDJWNas0sPn+65GRJSORuwkWjQuOCQsd2LkCpbAXn5cdRXLWXSk84r6Ms2Q2RGSdi31T1LWBJiU3lotToHlkgKJWlW8QnVgFzUhTAyGkplDJiJjsqkJ0kDfw2cjRsgLB2bBNmDGnwJ8CfAnwJ8CfA4yxLDglSwaV2ZZ8uj0Cr2Dg38lmEylZVoEjscAjEdnD8oWKPldEmjRNLX++222PrnbGmuM77a4yALoH290R6psbPlXFNkvOWuO6wXkDLexw0ABzbvbpzaOhBp5ZegalthnrG6Nr8qOMjdAZ+TsDxoxsXZLJB49oto4yAaKv8AQiT4kNNHqE6j7ODWNYBy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XURj1m1VeY8Mg1QHO7KpyTk2DAzIk0GbHTLrd1s3U2Ypu1GGxH8j3cKq5q8b5/e1zUt2N6bd7Wt6FSakDWszoeoTVYw6jKBrybIrtHbGZPauhpoi0k8iaumTBZBbOzLVVUe3wQTfIIpoagyB8D/2Q==' /></span>
            </div>
            <div style="display:flex; flex-direction: column; align-items: center">
                <span style="font-size: larger; font-weight: 600">[VisitorName]</span>
                <span>[VisitorCompany]</span>
            </div>
            <div style="display: flex; justify-content: space-between">
                <div style="display: flex; flex-direction: column">
                    <span>DATE OF VISIT</span>
                    <span>[CheckinTime]</span>
                </div>
                <div style="display: flex; flex-direction: column; align-items: flex-end">
                    <span>HOST</span>
                    <span>[HostName]</span>
                </div>
            </div>
        </div>
    </body>
</html>

我的初始实现在iOS模拟器上运行良好,但是在实际设备上,图像没有被打印(只是空白):

private static void PrintToPrinter(string label, UIPrinter selectedPrinter)
{
    var printInfo = UIPrintInfo.PrintInfo;
    printInfo.JobName = "My Job";
    printInfo.OutputType = UIPrintInfoOutputType.General;
    printInfo.Orientation = UIPrintInfoOrientation.Landscape;

    var htmlFormatter = new UIMarkupTextPrintFormatter(label);

    var printer = UIPrintInteractionController.SharedPrintController;
    printer.PrintInfo = printInfo;
    printer.PrintFormatter = htmlFormatter;
    printer.PrintToPrinter(selectedPrinter, (printInteractionController, completed, error) =>
    {
        if (!completed && error != null)
        {
            Console.WriteLine($"Error: {error.LocalizedDescription ?? ""}");
        }
    });

    printInfo.Dispose();
    htmlFormatter.Dispose();
}

我读到其他人有图像无法打印的问题,因为渲染显然是异步发生的:https://stackoverflow.com/a/40320983

因此,我的下一个尝试是将标记加载到Web视图中,但是我不确定如何等待标记完全加载,因此这是我的幼稚尝试。它永远不会超越while循环:

private static void PrintToPrinter(string label, UIPrinter selectedPrinter)
{
    WkWebViewRenderer renderer = new WkWebViewRenderer();
    renderer.LoadHtml(label, null);

    while (renderer.IsLoading)
    {
        Thread.Sleep(100);
    }

    var printInfo = UIPrintInfo.PrintInfo;
    printInfo.JobName = "My Job";
    printInfo.OutputType = UIPrintInfoOutputType.General;
    printInfo.Orientation = UIPrintInfoOrientation.Landscape;

    var printer = UIPrintInteractionController.SharedPrintController;
    printer.PrintInfo = printInfo;
    printer.PrintFormatter = renderer.ViewPrintFormatter;
    printer.PrintToPrinter(selectedPrinter, (printInteractionController, completed, error) =>
    {
        if (!completed && error != null)
        {
            Console.WriteLine($"Error: {error.LocalizedDescription ?? ""}");
        }
    });

    printInfo.Dispose();
    renderer.Dispose();
}

然后我尝试实例化一个WebView,但这只会打印一个空白页/标签:

private static void PrintToPrinter(string label, UIPrinter selectedPrinter)
{
    var view = new WebView
        {
            Source = new HtmlWebViewSource { Html = label }
        };

    var renderer = Platform.CreateRenderer(view);

    var printInfo = UIPrintInfo.PrintInfo;
    printInfo.JobName = "My Job";
    printInfo.OutputType = UIPrintInfoOutputType.General;
    printInfo.Orientation = UIPrintInfoOrientation.Landscape;

    var printer = UIPrintInteractionController.SharedPrintController;
    printer.PrintInfo = printInfo;
    printer.PrintFormatter = renderer.NativeView.ViewPrintFormatter;
    printer.PrintToPrinter(selectedPrinter, (printInteractionController, completed, error) =>
    {
        if (!completed && error != null)
        {
            Console.WriteLine($"Error: {error.LocalizedDescription ?? ""}");
        }
    });

    printInfo.Dispose();
    renderer.Dispose();
}

[尝试找到一种等待视图加载的方法,我尝试了此方法,但是从未调用过Navigated事件:

private static void PrintToPrinter(string label, UIPrinter selectedPrinter)
{
    var view = new WebView();

    view.Navigated += (sender, e) =>
    {
        var renderer = Platform.CreateRenderer(view);

        var printInfo = UIPrintInfo.PrintInfo;
        printInfo.JobName = "My Job";
        printInfo.OutputType = UIPrintInfoOutputType.General;
        printInfo.Orientation = UIPrintInfoOrientation.Landscape;

        var printer = UIPrintInteractionController.SharedPrintController;
        printer.PrintInfo = printInfo;
        printer.PrintFormatter = renderer.NativeView.ViewPrintFormatter;
        printer.PrintToPrinter(selectedPrinter, (printInteractionController, completed, error) =>
        {
            if (!completed && error != null)
            {
                Console.WriteLine($"Error: {error.LocalizedDescription ?? ""}");
            }
        });

        printInfo.Dispose();
        renderer.Dispose();
    };

    view.Source = new HtmlWebViewSource { Html = label };
}

我不确定还可以尝试什么,但是我愿意接受任何建议。

xamarin.forms xamarin.ios
1个回答
0
投票

我非常想这样做,但这太难了。最终将其内置于Forms9Patch-MIT许可的open source project

确认可以进行打印

© www.soinside.com 2019 - 2024. All rights reserved.