English 中文(简体)
页: 1 印刷工作失败
原标题:iPhone 4.2 airprint Print job fails

No matter which printer I select, I get "Print-job failed: Unsupported document format "application/pdf".

我只想在惠普印刷厂印刷。

I see no place in code to change the output type.

I am using UISimpleTextFormatter to format the string.

Not sure how to get around this one.

http://www.ohchr.org。 下面的《法典》从Miguel s例子中简单明了。 唯一区别是,我尝试了标本,看看它是否以不同于application/pdf的格式获得产出。

The print dialog comes up with the list of HP printers, I select a printer but nothing gets printed and in debug mode, the error specified at the top gets logged.

UIPrintInfoOutputType. General外,我还尝试了UIPrintInfoOutputType.GrayScale,但效果相同。

public partial class AppDelegate : UIApplicationDelegate
    {
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            window.MakeKeyAndVisible ();
            var button = UIButton.FromType (UIButtonType.RoundedRect);
            button.Frame = new RectangleF (100, 100, 120, 60);
            button.SetTitle ("Print", UIControlState.Normal);
            button.TouchDown += delegate {
                Print ();
            };
            window.AddSubview (button);
            return true;
        }

        void Print ()
        {
            var printInfo = UIPrintInfo.PrintInfo;
            printInfo.JobName = "Test :";
            printInfo.OutputType = UIPrintInfoOutputType.General;
            printInfo.JobName = "Test: My first Print Job";

            /*
            var textFormatter = new UISimpleTextPrintFormatter ("Once upon a time...") {
                StartPage = 0,
                ContentInsets = new UIEdgeInsets (72, 72, 72, 72),
                MaximumContentWidth = 6 * 72,               
            };
            */
            var htmlFormatter = new UIMarkupTextPrintFormatter("<html><body>Test : Hi There!!</body></html>");
            htmlFormatter.StartPage = 0;
            htmlFormatter.ContentInsets = new UIEdgeInsets (72, 72, 72, 72); // 1 inch margins
            htmlFormatter.MaximumContentWidth = 6 * 72;                 

            var printer = UIPrintInteractionController.SharedPrintController;
            printer.PrintInfo = printInfo;
            printer.PrintFormatter = htmlFormatter;
            printer.ShowsPageRange = true;
            printer.Present (true, (handler, completed, err) => {
                if (!completed && err != null){
                    Console.WriteLine ("error");
                }
            });
        }

        public override void OnActivated (UIApplication application)
        {
        }
    }
最佳回答

I was expecting the print dialog to come up with only the air print enabled printers. But it comes up with non airprint enabled HP printers as well. That amde me think, it could print to those printers and that they are air print enabled.

But that was not the case.

问题回答

暂无回答




相关问题
Write to a File in Monotouch

How would I create and write to a file in a Monotouch iPhone app? The file should persist between application launches, so I guess it has to be placed somewhere in the App bundle ( documents or ...

MonoTouch debugger never connects to app

I have an issue where the MonoDevelop debugger refuses to connect to the simulator. MonoDevelop pops a box saying "Waiting for debugger to connect on 127.0.0.1:10000..." but never connects. I have ...

montouch detect when sound finished playing

In objective C is a method called AudioServicesAddSystemSoundCompletion which allows to add a handler for "audio done notification". So I add the handler call AudioServicesPlaySystemSound and when the ...

Web Services Build Error in Monotouch

My project and web services work fine in the simulator but crash when uploading to an iPhone. It had been working fine before I updated Monotouch from 1.1. Can I revert back to earlier versions of ...

Playing a Sound With Monotouch

No matter what I try (build -> content, NSUrl, filename) I get a null exception : file not found when I try to play a .caf sound file in monotouch. //var path = NSBundle.MainBundle.PathForResource("...

Is MonoDevelop s editor slow for you?

I m using the evaluation version of MonoTouch and MonoDevelop to check out writing iPhone app in C#. However, MonoDevelop s editor is very slow for me. I mean really really slow. I have to type and ...

C# Class Definition

In XCode and objective c, if I want to use a UIGlassButton in interface builder, I put the following line in my header file: @class UIGlassButton; I am now using monotouch c#. Is there a similar ...

热门标签