本文整理汇总了C#中PrintTicket类的典型用法代码示例。如果您正苦于以下问题:C# PrintTicket类的具体用法?C# PrintTicket怎么用?C# PrintTicket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrintTicket类属于命名空间,在下文中一共展示了PrintTicket类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnPrintCommand
/// <summary>
/// Get a print dialog, defaulted to default printer and default printer's preferences.
/// </summary>
protected override void OnPrintCommand()
{
// get a print dialog, defaulted to default printer and default printer's preferences.
PrintDialog printDialog = new PrintDialog();
printDialog.PrintQueue = mPrintQueue;
printDialog.PrintTicket = mPrintTicket;
if (printDialog.ShowDialog() == true)
{
mPrintQueue = printDialog.PrintQueue;
mPrintTicket = printDialog.PrintTicket;
printDialog.PrintDocument(this.Document.DocumentPaginator, "PrintPreviewJob");
}
}
开发者ID:joazlazer,项目名称:ModdingStudio,代码行数:21,代码来源:PrintPreviewDocumentViewer.cs
示例2: PrintData
protected void PrintData(string username, PrintTicket ticket, string printername, string jobname, byte[] data, string driver)
{
using (Ghostscript gs = new Ghostscript())
{
if (driver != null)
{
byte[] outdata = gs.ProcessData(ticket, data, driver, null, null);
WindowsRawPrintJob pj = new WindowsRawPrintJob
{
JobName = jobname,
PrinterName = printername,
UserName = username,
PrintData = outdata,
RunAsUser = true
};
pj.Print();
}
else
{
gs.PrintData(username, ticket, printername, jobname, data, new string[] { });
}
}
}
开发者ID:klightspeed,项目名称:CloudPrintProxy,代码行数:25,代码来源:GhostscriptPrinter.cs
示例3: ModifyPrintTicket
public static PrintTicket ModifyPrintTicket(PrintTicket ticket, string featureName, string newValue)
{
if (ticket == null)
{
throw new ArgumentNullException("ticket");
}
var xmlDoc = new XmlDocument();
xmlDoc.Load(ticket.GetXmlStream());
var manager = new XmlNamespaceManager(xmlDoc.NameTable);
manager.AddNamespace(xmlDoc.DocumentElement.Prefix, xmlDoc.DocumentElement.NamespaceURI);
var xpath = string.Format("//psf:Feature[contains(@name, 'InputBin')]/psf:Option", featureName);
var node = xmlDoc.SelectSingleNode(xpath, manager);
if (node != null)
{
node.Attributes["name"].Value = newValue;
}
var printTicketStream = new MemoryStream();
xmlDoc.Save(printTicketStream);
printTicketStream.Position = 0;
var modifiedPrintTicket = new PrintTicket(printTicketStream);
return modifiedPrintTicket;
}
开发者ID:modulexcite,项目名称:printengine,代码行数:26,代码来源:XpsPrinterUtils.cs
示例4: InternalCreateFileFromXaml
private static CreateXpsFileResult InternalCreateFileFromXaml(FrameworkElement template, object dataContext)
{
string xpsFile = Path.GetTempFileName() + ".xps";
using (var container = Package.Open(xpsFile, FileMode.Create))
using (var document = new XpsDocument(container, CompressionOption.SuperFast))
{
var coupon = template;
coupon.DataContext = dataContext;
coupon.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
coupon.UpdateLayout();
var ticket = new PrintTicket()
{
PageMediaSize = new PageMediaSize(coupon.DesiredSize.Width, coupon.DesiredSize.Height)
};
XpsDocument.CreateXpsDocumentWriter(document).Write(coupon, ticket);
return new CreateXpsFileResult()
{
Path = xpsFile,
Ticket = ticket
};
}
}
开发者ID:breslavsky,项目名称:queue,代码行数:27,代码来源:XPSUtils.cs
示例5: PreparePrinting
public void PreparePrinting(PrintTicket printTicket, Size pageSize)
{
printTicket.PageOrientation = pageSize.Height >= pageSize.Width ? PageOrientation.Portrait : PageOrientation.Landscape;
var printExtension = _reportProvider as IReportPrintExtension;
if (printExtension != null)
printExtension.PreparePrinting(printTicket, pageSize);
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:7,代码来源:ReportViewModel.cs
示例6: PrintDialog
/// <summary>
/// Invokes a System.Windows.Controls.PrintDialog to print the TextEditor.Document with specified title.
/// </summary>
public static void PrintDialog(this TextEditor textEditor, string title)
{
Printing.mDocumentTitle = title;
Printing.InitPageSettings();
System.Windows.Controls.PrintDialog printDialog = new System.Windows.Controls.PrintDialog();
printDialog.PrintQueue = mPrintQueue;
if (mPageSettings.Landscape)
Printing.mPrintTicket.PageOrientation = PageOrientation.Landscape;
printDialog.PrintTicket = mPrintTicket;
printDialog.PrintQueue.DefaultPrintTicket.PageOrientation = mPrintTicket.PageOrientation;
if (printDialog.ShowDialog() == true)
{
Printing.mPrintQueue = printDialog.PrintQueue;
Printing.mPrintTicket = printDialog.PrintTicket;
printDialog.PrintDocument(CreateDocumentPaginatorToPrint(textEditor), "PrintJob");
}
}
开发者ID:joazlazer,项目名称:ModdingStudio,代码行数:28,代码来源:Printing.cs
示例7: VerifyPrintSettings
/// <summary>
/// Ensure Queue and Ticket prepared
/// </summary>
private void VerifyPrintSettings()
{
if (mPrintQueue == null)
mPrintQueue = DefaultPrintQueue();
if (mPrintTicket == null)
mPrintTicket = DefaultPrintTicket();
}
开发者ID:Patagames,项目名称:Pdf.Wpf,代码行数:11,代码来源:ThreadSafePrintDialog.cs
示例8: PrintData
public void PrintData(string username, PrintTicket ticket, string printername, string jobname, byte[] data, string[] inargs)
{
string[] devsetup = SetDeviceCommand("%printer%" + printername, jobname, "mswinpr2").ToArray();
string[] extraargs = new string[] { "-dNOSAFER" };
SetupUserPrinter(username, printername);
ProcessData(username, ticket, data, inargs, extraargs, devsetup);
}
开发者ID:klightspeed,项目名称:CloudPrintProxy,代码行数:9,代码来源:Ghostscript.cs
示例9: ProcessPCL
protected PaginatedPrintData ProcessPCL(byte[] rawdata, Dictionary<string, string> pjljobattribs, PrintTicket ticket)
{
PCLXLPrintJob pcljob = new PCLXLPrintJob(rawdata);
return new PaginatedPrintData
{
Prologue = PJLHelper.GetPJL(pjljobattribs, ticket, "PCLXL").Concat(pcljob.Prologue).ToArray(),
PageData = pcljob.PageData.ToArray(),
Epilogue = pcljob.Epilogue.Concat(PJLHelper.GetEndJobPJL()).ToArray(),
};
}
开发者ID:klightspeed,项目名称:CloudPrintProxy,代码行数:10,代码来源:GhostscriptPCLXLPrinter.cs
示例10: GetPJL
public static byte[] GetPJL(Dictionary<string, string> jobattribs, PrintTicket ticket, string language)
{
Dictionary<string, string> pjlsettings = new Dictionary<string, string>
{
{ "DUPLEX", ticket.Duplexing == Duplexing.OneSided ? "OFF" : "ON" },
{ "BINDING", ticket.Duplexing == Duplexing.TwoSidedShortEdge ? "SHORTEDGE" : "LONGEDGE" },
{ "COPIES", (ticket.CopyCount ?? 1).ToString() },
{ "RENDERMODE", ticket.OutputColor == OutputColor.Color ? "COLOR" : "GRAYSCALE" },
{ "STAPLE", GetStapling(ticket.Stapling) }
};
return GetPJL(jobattribs, pjlsettings, language);
}
开发者ID:klightspeed,项目名称:CloudPrintProxy,代码行数:13,代码来源:PJLHelper.cs
示例11: DocumentPaginatorWrapper
/// <summary>
/// Class constructor
/// </summary>
/// <param name="paginator"></param>
/// <param name="pageSettings"></param>
/// <param name="printTicket"></param>
/// <param name="headerFooterfontFamily"></param>
public DocumentPaginatorWrapper(DocumentPaginator paginator, PageSettings pageSettings, PrintTicket printTicket, FontFamily headerFooterfontFamily)
{
m_Margins = ConvertMarginsToPx(pageSettings.Margins);
if (pageSettings.Landscape)
m_PageSize = new Size((int)printTicket.PageMediaSize.Height, (int)printTicket.PageMediaSize.Width);
else
m_PageSize = new Size((int)printTicket.PageMediaSize.Width, (int)printTicket.PageMediaSize.Height);
m_Paginator = paginator;
m_Paginator.PageSize = new Size(m_PageSize.Width - m_Margins.Left - m_Margins.Right, m_PageSize.Height - m_Margins.Top - m_Margins.Bottom);
m_Typeface = new Typeface(headerFooterfontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
}
开发者ID:joazlazer,项目名称:ModdingStudio,代码行数:21,代码来源:DocumentPaginatorWrapper.cs
示例12: Print
public void Print(string username, byte[] data, string printername, string jobname, PrintTicket ticket)
{
PopplerGDIPrintJob pj = new PopplerGDIPrintJob
{
PrintData = data,
PrinterName = printername,
PrintTicket = ticket,
JobName = jobname,
RunAsUser = username != null,
UserName = username
};
pj.Print();
}
开发者ID:klightspeed,项目名称:CloudPrintProxy,代码行数:14,代码来源:PopplerGDIPrinter.cs
示例13: PrintOnClick
void PrintOnClick(object sender, RoutedEventArgs args)
{
PrintDialog dlg = new PrintDialog();
if (prnqueue != null)
dlg.PrintQueue = prnqueue;
if (prntkt != null)
dlg.PrintTicket = prntkt;
if (dlg.ShowDialog().GetValueOrDefault())
{
prnqueue = dlg.PrintQueue;
prntkt = dlg.PrintTicket;
DrawingVisual vis = new DrawingVisual();
DrawingContext dc = vis.RenderOpen();
Pen pn = new Pen(Brushes.Black, 1);
Rect rectPage = new Rect(marginPage.Left, marginPage.Top,
dlg.PrintableAreaWidth - (marginPage.Left + marginPage.Right),
dlg.PrintableAreaHeight - (marginPage.Top + marginPage.Bottom));
dc.DrawRectangle(null, pn, rectPage);
FormattedText formtxt = new FormattedText(
String.Format("Hello, Printer! {0} x {1}", dlg.PrintableAreaWidth/96, dlg.PrintableAreaHeight/96),
CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(
new FontFamily("Times New Roman"), FontStyles.Italic, FontWeights.Normal, FontStretches.Normal),
48, Brushes.Black);
Size sizeText = new Size(formtxt.Width, formtxt.Height);
Point ptText = new Point(rectPage.Left + (rectPage.Width - formtxt.Width) / 2,
rectPage.Top + (rectPage.Height - formtxt.Height) / 2);
dc.DrawText(formtxt, ptText);
dc.DrawRectangle(null,pn, new Rect(ptText, sizeText));
dc.Close();
dlg.PrintVisual(vis, Title);
}
}
开发者ID:JianchengZh,项目名称:kasicass,代码行数:41,代码来源:PrintWithMargins.cs
示例14: PrintData
protected void PrintData(string username, PrintTicket ticket, string printername, string jobname, byte[] data, Dictionary<string, string> pjljobattribs)
{
using (Ghostscript gs = new Ghostscript())
{
string driver = ticket.OutputColor == OutputColor.Color ? "pxlcolor" : "pxlmono";
byte[] pcldata = gs.ProcessData(ticket, data, driver, null, null);
PaginatedPrintData pcljob = ProcessPCL(pcldata, pjljobattribs, ticket);
WindowsRawPrintJob job = new WindowsRawPrintJob
{
PagedData = pcljob,
JobName = jobname,
PrinterName = printername,
UserName = username,
RunAsUser = true
};
job.Print();
}
}
开发者ID:klightspeed,项目名称:CloudPrintProxy,代码行数:21,代码来源:GhostscriptPCLXLPrinter.cs
示例15: PrintOnExecuted
void PrintOnExecuted(object sender, ExecutedRoutedEventArgs args)
{
PrintDialog dlg = new PrintDialog();
// Get the PrintQueue and PrintTicket from previous invocations.
if (prnqueue != null)
dlg.PrintQueue = prnqueue;
if (prntkt != null)
dlg.PrintTicket = prntkt;
if (dlg.ShowDialog().GetValueOrDefault())
{
// Save PrintQueue and PrintTicket from dialog box.
prnqueue = dlg.PrintQueue;
prntkt = dlg.PrintTicket;
// Create a PlainTextDocumentPaginator object.
PlainTextDocumentPaginator paginator =
new PlainTextDocumentPaginator();
// Set the paginator properties.
paginator.PrintTicket = prntkt;
paginator.Text = txtbox.Text;
paginator.Header = strLoadedFile;
paginator.Typeface =
new Typeface(txtbox.FontFamily, txtbox.FontStyle,
txtbox.FontWeight, txtbox.FontStretch);
paginator.FaceSize = txtbox.FontSize;
paginator.TextWrapping = txtbox.TextWrapping;
paginator.Margins = marginPage;
paginator.PageSize = new Size(dlg.PrintableAreaWidth,
dlg.PrintableAreaHeight);
// Print the document.
dlg.PrintDocument(paginator, Title);
}
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:37,代码来源:NotepadClone.Print.cs
示例16: ModifyPrintTicket
public static PrintTicket ModifyPrintTicket(PrintTicket ticket, string featureName, string newValue)
{
if (ticket == null)
{
throw new ArgumentNullException("ticket");
}
// read Xml of the PrintTicket
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(ticket.GetXmlStream());
// create NamespaceManager and add PrintSchemaFrameWork-Namespace hinzufugen (should be on DocumentElement of the PrintTicket)
// Prefix: psf NameSpace: xmlDoc.DocumentElement.NamespaceURI = "http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"
XmlNamespaceManager manager = new XmlNamespaceManager(xmlDoc.NameTable);
manager.AddNamespace(xmlDoc.DocumentElement.Prefix, xmlDoc.DocumentElement.NamespaceURI);
// search node with desired feature we're looking for and set newValue for it
string xpath = string.Format("//psf:Feature[@name='{0}']/psfSurpriseption", featureName);
XmlNode node = xmlDoc.SelectSingleNode(xpath, manager);
if (node != null)
{
node.Attributes["name"].Value = newValue;
}
// create a new PrintTicket out of the XML
MemoryStream printTicketStream = new MemoryStream();
xmlDoc.Save(printTicketStream);
printTicketStream.Position = 0;
PrintTicket modifiedPrintTicket = new PrintTicket(printTicketStream);
// for testing purpose save the printticket to file
//FileStream stream = new FileStream("modPrintticket.xml", FileMode.CreateNew, FileAccess.ReadWrite);
//modifiedPrintTicket.GetXmlStream().WriteTo(stream);
return modifiedPrintTicket;
}
开发者ID:alexanderwieland,项目名称:PrintTicket,代码行数:36,代码来源:Program.cs
示例17: PrintOnExecuted
//PrintOnExecuted �̺�Ʈ ȣ��� ��
void PrintOnExecuted(object sender, ExecutedRoutedEventArgs args)
{
PrintDialog dlg = new PrintDialog();
//PrintDialog ��ü����.
if (prnqueue != null)
dlg.PrintQueue = prnqueue;
//���� ���� �����ߴ� ������ ���ٸ�..(ó���״ٸ�) �Ѿ�� �ִٸ�
//���� printdlg�� �־��ش�.
if (prntkt != null)
dlg.PrintTicket = prntkt;
//���� ����... (�̰��� ���γ� ���η� �������ϴ°Ͱ� ���� �ɼ�)
if (dlg.ShowDialog().GetValueOrDefault())
{ //ok�� ������...
//PrintDialog���� ������ ������ �Է¹� �����´�.
prnqueue = dlg.PrintQueue;
prntkt = dlg.PrintTicket;
//dlg���� ����� ���� �ɼ��� ���߿� �ٽ� �� �� �ֵ���
//�� ��ü�� �����Ѵ�.
PlainTextDocumentPaginator paginator =
new PlainTextDocumentPaginator();
//PlainTextDocumentPaginator ��ü ����.
paginator.PrintTicket = prntkt;
//������ ���� ������ �����´�.
paginator.Text = txtbox.Text;
//������ ������ �����´�.
paginator.Header = strLoadedFile;
//������ ������ִ� ������ �����´�.
paginator.Typeface =
new Typeface(txtbox.FontFamily, txtbox.FontStyle,
txtbox.FontWeight, txtbox.FontStretch);
//���� �۲ÿ� ���� ��Ÿ�ϵ��� �����ش�. (���⼭�� ���߽�Ÿ�� ���� �ȵ�)
paginator.FaceSize = txtbox.FontSize;
//�۲� ������
paginator.TextWrapping = txtbox.TextWrapping;
//���õ� Wrapping ������ �����ش�.
//����ڰ� ������ ��� text�� ���õ� �ΰ����� ������ paginator��ü�� �����ش�.
paginator.Margins = marginPage;
//���� ������ �����ش�.
paginator.PageSize = new Size(dlg.PrintableAreaWidth,
dlg.PrintableAreaHeight);
//������ ��ü ũ�⸦ �����ش�.
dlg.PrintDocument(paginator, Title);
//paginator ��ü�� �̿��Ͽ� ���� ����Ʈ�� �Ѵ�.
//�� ���������� PlainTextDocumentPaginator.cs�� �ִ� GetPage���� ���Ϲ���
//�������� ���������ִ� �� ����.
}
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:52,代码来源:NotepadClone.Print.cs
示例18: PrintTicket
/* Print ticket handling. You can customize for PrintTicketLevel at
FixedDocumentSequencePrintTicket, FixedDocumentPrintTicket,
or FixedPagePrintTicket. We may want to play around with this some */
private void PrintTicket(Object sender, WritingPrintTicketRequiredEventArgs e)
{
if (e.CurrentPrintTicketLevel ==
PrintTicketLevel.FixedDocumentSequencePrintTicket)
{
PrintTicket pts = new PrintTicket();
pts.PageOrientation = PageOrientation.Portrait;
e.CurrentPrintTicket = pts;
}
}
开发者ID:surjit,项目名称:mupdf-1,代码行数:13,代码来源:gsprint.cs
示例19: WriteAsync
public abstract void WriteAsync(Visual visual, PrintTicket printTicket, object userState);
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:1,代码来源:SerializerWriterCollator.cs
示例20: Write
public override void Write(FixedDocument fixedDocument, PrintTicket printTicket)
{
SerializeObjectTree(fixedDocument);
}
开发者ID:hinduCoder,项目名称:Diploma,代码行数:4,代码来源:rtfserializerwriter.cs
注:本文中的PrintTicket类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论