Пример #1
0
        public PMStatusCode TryGetPaperList(out PMPaper [] paperList)
        {
            IntPtr m;
            var    code = PMPrinterGetPaperList(handle, out m);

            if (code != PMStatusCode.Ok)
            {
                paperList = null;
                return(code);
            }
            int c = (int)CFArray.GetCount(m);

            paperList = new PMPaper [c];
            for (int i = 0; i < c; i++)
            {
                paperList [i] = new PMPaper(CFArray.CFArrayGetValueAtIndex(m, i), owns: false);
            }

            return(PMStatusCode.Ok);
        }
Пример #2
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);
        }
Пример #3
0
        public PMPageFormat(PMPaper paper = null)
        {
            IntPtr       value;
            PMStatusCode code;

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

            if (code == PMStatusCode.Ok)
            {
                handle = value;
            }
            else
            {
                throw new PMPrintException(code);
            }
        }