Limitless printing
-
Hello, I have a problem with my application at the time of printing. When I print with the print button of the report viewer in the viewer my printing works fine. And when I run printing without previewing the report limit is limited to where the rectangle is limited. I specify well I use a thermal printer in roll paper Here is my code
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;namespace POS_System_Inventory
{
public static class LocalReportExtensions
{
public static void PrintToPrinter(this LocalReport report)
{
PageSettings pageSettings = new PageSettings();
pageSettings.PaperSize = report.GetDefaultPageSettings().PaperSize;
pageSettings.Landscape = report.GetDefaultPageSettings().IsLandscape;
pageSettings.Margins = report.GetDefaultPageSettings().Margins;
Print(report, pageSettings);
}public static void Print(this LocalReport report, PageSettings pageSettings) { string deviceInfo = @" EMF {pageSettings.PaperSize.Width \* 100}in {pageSettings.PaperSize.Height \* 100}in {pageSettings.Margins.Top \* 100}in {pageSettings.Margins.Left \* 100}in {pageSettings.Margins.Right \* 100}in {pageSettings.Margins.Bottom \* 100}in "; Warning\[\] warnings; var streams = new List(); var pageIndex = 0; report.Render("Image", deviceInfo, (name, fileNameExtension, encoding, mimeType, willSeek) => { MemoryStream stream = new MemoryStream(); streams.Add(stream); return stream; }, out warnings); foreach (Stream stream in streams) stream.Position = 0; if (streams == null || streams.Count == 0) throw new Exception("Aucun flux à imprimer."); usin
-
Hello, I have a problem with my application at the time of printing. When I print with the print button of the report viewer in the viewer my printing works fine. And when I run printing without previewing the report limit is limited to where the rectangle is limited. I specify well I use a thermal printer in roll paper Here is my code
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;namespace POS_System_Inventory
{
public static class LocalReportExtensions
{
public static void PrintToPrinter(this LocalReport report)
{
PageSettings pageSettings = new PageSettings();
pageSettings.PaperSize = report.GetDefaultPageSettings().PaperSize;
pageSettings.Landscape = report.GetDefaultPageSettings().IsLandscape;
pageSettings.Margins = report.GetDefaultPageSettings().Margins;
Print(report, pageSettings);
}public static void Print(this LocalReport report, PageSettings pageSettings) { string deviceInfo = @" EMF {pageSettings.PaperSize.Width \* 100}in {pageSettings.PaperSize.Height \* 100}in {pageSettings.Margins.Top \* 100}in {pageSettings.Margins.Left \* 100}in {pageSettings.Margins.Right \* 100}in {pageSettings.Margins.Bottom \* 100}in "; Warning\[\] warnings; var streams = new List(); var pageIndex = 0; report.Render("Image", deviceInfo, (name, fileNameExtension, encoding, mimeType, willSeek) => { MemoryStream stream = new MemoryStream(); streams.Add(stream); return stream; }, out warnings); foreach (Stream stream in streams) stream.Position = 0; if (streams == null || streams.Count == 0) throw new Exception("Aucun flux à imprimer."); usin
Repost: this is the same problem you asked about 3 days ago: Printe page limit - C# Discussion Boards[^] Don't repost the same question repeatedly - it just wastes time and effort!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
Hello, I have a problem with my application at the time of printing. When I print with the print button of the report viewer in the viewer my printing works fine. And when I run printing without previewing the report limit is limited to where the rectangle is limited. I specify well I use a thermal printer in roll paper Here is my code
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;namespace POS_System_Inventory
{
public static class LocalReportExtensions
{
public static void PrintToPrinter(this LocalReport report)
{
PageSettings pageSettings = new PageSettings();
pageSettings.PaperSize = report.GetDefaultPageSettings().PaperSize;
pageSettings.Landscape = report.GetDefaultPageSettings().IsLandscape;
pageSettings.Margins = report.GetDefaultPageSettings().Margins;
Print(report, pageSettings);
}public static void Print(this LocalReport report, PageSettings pageSettings) { string deviceInfo = @" EMF {pageSettings.PaperSize.Width \* 100}in {pageSettings.PaperSize.Height \* 100}in {pageSettings.Margins.Top \* 100}in {pageSettings.Margins.Left \* 100}in {pageSettings.Margins.Right \* 100}in {pageSettings.Margins.Bottom \* 100}in "; Warning\[\] warnings; var streams = new List(); var pageIndex = 0; report.Render("Image", deviceInfo, (name, fileNameExtension, encoding, mimeType, willSeek) => { MemoryStream stream = new MemoryStream(); streams.Add(stream); return stream; }, out warnings); foreach (Stream stream in streams) stream.Position = 0; if (streams == null || streams.Count == 0) throw new Exception("Aucun flux à imprimer."); usin
Looking at your code with a very limited understanding of the domain, I am wondering if
Member 14192216 wrote:
string deviceInfo =
@"<DeviceInfo>
<OutputFormat>EMF</OutputFormat>
<PageWidth>{pageSettings.PaperSize.Width * 100}in</PageWidth>
<PageHeight>{pageSettings.PaperSize.Height * 100}in</PageHeight>
<MarginTop>{pageSettings.Margins.Top * 100}in</MarginTop>
<MarginLeft>{pageSettings.Margins.Left * 100}in</MarginLeft>
<MarginRight>{pageSettings.Margins.Right * 100}in</MarginRight>
<MarginBottom>{pageSettings.Margins.Bottom * 100}in</MarginBottom>
</DeviceInfo>";is meant to be an interpolated string. If so, try changing the
@"..."
to$@"..."
so that the expressions inside{...}
sections are evaluated. It may be that the uninterpolated values are being treated as invalid number, which are treated a undefined items so the defaults for the geometry are used. -
Hello, I have a problem with my application at the time of printing. When I print with the print button of the report viewer in the viewer my printing works fine. And when I run printing without previewing the report limit is limited to where the rectangle is limited. I specify well I use a thermal printer in roll paper Here is my code
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;namespace POS_System_Inventory
{
public static class LocalReportExtensions
{
public static void PrintToPrinter(this LocalReport report)
{
PageSettings pageSettings = new PageSettings();
pageSettings.PaperSize = report.GetDefaultPageSettings().PaperSize;
pageSettings.Landscape = report.GetDefaultPageSettings().IsLandscape;
pageSettings.Margins = report.GetDefaultPageSettings().Margins;
Print(report, pageSettings);
}public static void Print(this LocalReport report, PageSettings pageSettings) { string deviceInfo = @" EMF {pageSettings.PaperSize.Width \* 100}in {pageSettings.PaperSize.Height \* 100}in {pageSettings.Margins.Top \* 100}in {pageSettings.Margins.Left \* 100}in {pageSettings.Margins.Right \* 100}in {pageSettings.Margins.Bottom \* 100}in "; Warning\[\] warnings; var streams = new List(); var pageIndex = 0; report.Render("Image", deviceInfo, (name, fileNameExtension, encoding, mimeType, willSeek) => { MemoryStream stream = new MemoryStream(); streams.Add(stream); return stream; }, out warnings); foreach (Stream stream in streams) stream.Position = 0; if (streams == null || streams.Count == 0) throw new Exception("Aucun flux à imprimer."); usin
You're confusing "logical" printing and "physical" printing. There is no evidence that the "thermal printer" understands what you're sending it. (thermal printers can have their own "language") You start by sending "one line" / chaeacter to the printer. When that works, you'll have some confidence you're on the right track; otherwise, you're just grasping.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food