Exemplo n.º 1
0
 public void AssignDefaultPageFormat(PMPageFormat pageFormat)
 {
     if (pageFormat == null)
     {
         throw new ArgumentNullException(nameof(pageFormat));
     }
     PMSessionDefaultPageFormat(handle, pageFormat.Handle);
 }
Exemplo n.º 2
0
        public PMStatusCode TryPrintFromProvider(PMPrintSettings settings, PMPageFormat pageFormat, CGDataProvider provider, string mimeType = null)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            IntPtr mime = CFString.LowLevelCreate(mimeType);
            var    code = PMPrinterPrintWithProvider(handle, settings.handle, pageFormat == null ? IntPtr.Zero : pageFormat.handle, mime, provider.Handle);

            if (mime != IntPtr.Zero)
            {
                CFObject.CFRelease(mime);
            }
            return(code);
        }
Exemplo n.º 3
0
        public PMStatusCode TryPrintFile(PMPrintSettings settings, PMPageFormat pageFormat, NSUrl fileUrl, string mimeType = null)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (fileUrl == null)
            {
                throw new ArgumentNullException(nameof(fileUrl));
            }

            IntPtr mime = CFString.LowLevelCreate(mimeType);
            var    code = PMPrinterPrintWithFile(handle, settings.handle, pageFormat == null ? IntPtr.Zero : pageFormat.handle, mime, fileUrl.Handle);

            if (mime != IntPtr.Zero)
            {
                CFObject.CFRelease(mime);
            }
            return(code);
        }
Exemplo n.º 4
0
        public static PMStatusCode TryCreate(out PMPageFormat pageFormat, PMPaper paper = null)
        {
            PMStatusCode code;
            IntPtr       value;

            if (paper == null)
            {
                code = PMCreatePageFormat(out value);
            }
            else
            {
                code = PMCreatePageFormatWithPMPaper(out value, paper.Handle);
            }

            if (code == PMStatusCode.Ok)
            {
                pageFormat = new PMPageFormat(value, true);
                return(PMStatusCode.Ok);
            }
            pageFormat = null;
            return(code);
        }