on 06-20-2017 12:36 PM
SP 23 will have more updates to the WPF viewer. See if that resolves the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do those "other" printers have the ability to not scale the page?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All I can suggest then is don't use the CR WPF viewer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use an RTF file and not a text file so it is formatted and see if the margins are correct.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, need more details then.
What printer are you using?
Have you updated to a printer driver that supports .NET Framework?
Create a new app that just prints a text document, do not use CR just the framework to do the printing.
Like this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace DotNETPrint
{
public partial class Form1 : Form
{
private Button printButton;
private PrintDocument printDocument1 = new PrintDocument();
private string stringToPrint;
public Form1()
{
InitializeComponent();
this.printButton = new System.Windows.Forms.Button();
this.printButton.Location = new System.Drawing.Point(12, 51);
this.printButton.Size = new System.Drawing.Size(75, 23);
this.printButton.Text = "Print";
this.printButton.Click += new System.EventHandler(this.printButton_Click);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.printButton);
// Associate the PrintPage event handler with the PrintPage event.
printDocument1.PrintPage +=
new PrintPageEventHandler(printDocument1_PrintPage);
}
private void ReadFile()
{
string docName = "don.rtf"; //"begunix.txt"; // "don.rtf"; //
string docPath = ".\\";
printDocument1.DocumentName = docName;
using (FileStream stream = new FileStream(docPath + docName, FileMode.Open))
using (StreamReader reader = new StreamReader(stream))
{
stringToPrint = reader.ReadToEnd();
}
}
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
//int charactersOnPage = 0;
//int linesPerPage = 0;
//// Sets the value of charactersOnPage to the number of characters
//// of stringToPrint that will fit within the bounds of the page.
//e.Graphics.MeasureString(stringToPrint, this.Font,
// e.MarginBounds.Size, StringFormat.GenericTypographic,
// out charactersOnPage, out linesPerPage);
//// Draws the string within the bounds of the page
//e.Graphics.DrawString(stringToPrint, this.Font, Brushes.Black,
// e.MarginBounds, StringFormat.GenericTypographic);
//// Remove the portion of the string that has been printed.
//stringToPrint = stringToPrint.Substring(charactersOnPage);
//// Check to see if more pages are to be printed.
//e.HasMorePages = (stringToPrint.Length > 0);
// print word doc
System.Diagnostics.Process printProcess = new System.Diagnostics.Process();
printProcess.StartInfo.FileName = @"D:\CPP Net 2010\DotNETPrint\bin\Debug\don.rtf";
printProcess.StartInfo.Verb = "Print";
printProcess.StartInfo.CreateNoWindow = true;
printProcess.Start();
}
private void printButton_Click(object sender, EventArgs e)
{
ReadFile();
try
{
printDocument1.Print();
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
}
}
}
}
Does that work?
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok. I tried testing this source.
But I don't know if it was right....
i make don.rtf file with 'TEST PRINT' text .
this image output without '//' in printDocument1_PrintPage()
Otherwise, two pages are printed 1st page is 'TEST PRINT' 2nd page is blank.
thanks.
I change the Tag to CR for VS.
Install the latest SP 20 MSI and test again, note VS 2017 is not supported yet so install the 32 and 64 bit MSI:
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.