예제 #1
0
 public void AssignDefaultPageFormat(PMPageFormat pageFormat)
 {
     if (pageFormat is null)
     {
         throw new ArgumentNullException(nameof(pageFormat));
     }
     PMSessionDefaultPageFormat(Handle, pageFormat.Handle);
 }
예제 #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.CreateNative(mimeType);
            var    code = PMPrinterPrintWithProvider(handle, settings.handle, pageFormat == null ? IntPtr.Zero : pageFormat.handle, mime, provider.Handle);

            CFString.ReleaseNative(mime);
            return(code);
        }
예제 #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.CreateNative(mimeType);
            var    code = PMPrinterPrintWithFile(handle, settings.handle, pageFormat == null ? IntPtr.Zero : pageFormat.handle, mime, fileUrl.Handle);

            CFString.ReleaseNative(mime);
            return(code);
        }
예제 #4
0
        public static PMStatusCode TryCreate(out PMPageFormat?pageFormat, PMPaper?paper = null)
        {
            PMStatusCode code;
            IntPtr       value;

            if (paper is 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);
        }