![]() ![]() you can use WindowsDeviceModeMBS class to edit those settings if PrintSettings "" then MsgBox "Failed to load print settings." end if end if // print to named printer dim e as boolean = pdf.PrintPDFPageWithDialog( 1, "test", pdf.PrinterFlags, pdf.PrinterMargin, nil, self) If PrintSettings "" then if pdf.PrintSetDevMode(PrintSettings) then // ok else If not PreparePDF then Return // flags we need to pass for using Xojo's graphics class dim flags as integer = 0 // color or black/white? if RadioBW.Value thenĮnd if // rotate if needed if CheckAuto.Value thenįlags = BitwiseOr(flags, pdf.kpffAutoRotateAndCenter)Įnd if // shrink if needed if CheckShrink.Value thenįlags = BitwiseOr(flags, pdf.kpffShrinkToPrintArea)įlags = BitwiseOr(flags, pdf.kpffPrintPageAsIs) ![]() MsgBox "No pages?" Return false end if Return true End Function System.DebugLog "NumberOfPages: "+str(pdf.NumberOfPages) System.DebugLog "g.LastPage: "+str(g.LastPage) System.DebugLog "g.FirstPage: "+str(g.FirstPage) Return - 1 // stop End select End EventHandlerįunction PreparePDF(g as Graphics = nil) As Boolean // start new PDF contextĬall pdf.CreateNewPDF nil // import PDF dim n as integer = pdf.OpenImportFile(InputFile, 0, "") IgnoreWarnings = true Return 0 // ignore Case d.CancelButton Return 0 // ignore Case d.AlternateActionButton and display dialog: Dim d as New MessageDialog //declare the MessageDialog object Dim b as MessageDialogButton //for handling the resultĭ.icon=MessageDialog.GraphicCaution //display warning iconĭ.CancelButton.Visible= True //show the Cancel button // a warning or an error? if BitAnd(ErrorType, me.kE_WARNING) = me.kE_WARNING then // if user decided to ignore, we'll ignore if IgnoreWarnings then Return 0ĭ.Message= "A warning occurred while processing your PDF code." // we add a third button to display all warningsĭ.AlternateActionButton.Caption = "Ignore warnings"ĭ.AlternateActionButton.Visible = true elseĭ.Message= "An error occurred while processing your PDF code." end ifĭ.Explanation = str(ErrorCode)+ ": "+ErrorMessageī=d.ShowModal //display the dialog Select Case b //determine which button was pressed. ![]() System.DebugLog str(ErrorCode)+ ": "+ErrorMessage The "-" is interpreted as "page 1 to the end of the document".EventHandler Function Error(ErrorCode as integer, ErrorMessage as string, ErrorType as integer) As integer // output all messages on the console: The "2-" is interpreted as "pages 2 to the end of the document". The following examples assume a document with 20 total pages. If page range is not valid or if a page is greater than document total page count, ArgumentException is thrown. The pages are always printed in ascending order, even if specified in non-ascending order. To print multiple times, use the Copies property. Repeating a page does not print it multiple times. If the last page is not present, then the document total page count is used as the last page. The last page must be larger than the start page. If the start page is not present, then 1 is used as the start page. In a page range of the form - the start page number must be larger than 0 and less than or equal to the document's total page count. Every page identifier is an integer greater than 0 unless wildcards are used (see below examples). A valid page range is either a single integer identifying the page to print, or a range in the form - where start page and last page are integers identifying the first and last inclusive pages respectively to print. Any whitespace between page ranges is ignored. The PageRanges property is a list of page ranges specifying one or more pages that should be printed separated by commas. PageRanges as Stringĭefaults to empty string, which means print all pages. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |