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); }
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); }
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); } }