We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Print option issue

I am performing a text merge as well as inserting a barcode (aspose.barcode) into a document stream for printing. The output is going to a ZM400 thermal label printer. If I save my object as a document, then print, the document prints correctly onto a 3" x 2" label. If I simply pass my stream to the printer directly, the doc prints, but it prints counter clockwise, 90 degrees (I guess its portrait orientation).

I'm not sure if this is a words or barcode issue I need to address. Below is the code:

private void BuildLabel()
{
BarCodeBuilder bb = new BarCodeBuilder();
bb.CodeText = SerialNumber; bb.SymbologyType = Symbology.Code128;
bb.Code128CodeSet = Code128CodeSet.Auto;
bb.xDimension = .1f;
bb.BarHeight = 12f;
bb.CodeTextFont = new System.Drawing.Font("Lucida Console", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
System.IO.MemoryStream mStream = new System.IO.MemoryStream();
bb.BarCodeImage.Save(mStream, System.Drawing.Imaging.ImageFormat.Gif);
PrintLabel(bb);
}

private void PrintLabel(BarCodeBuilder barCode)
{
string path = @"C:\SomePath\CisLabels\";
Document doc = new Document(path + "CisLabel.docx");
doc.MailMerge.Execute(
new string[] { "PN", "QTY", "Description" },
new object[] { PartNumber, Qty, Description });
InsertBarcodeImage(doc, barCode);
//doc.Save("Merge.doc", SaveFormat.Doc, SaveType.OpenInWord,Response);
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = "ZDesigner ZM400 200 dpi (ZPL)";
//printerSettings.DefaultPageSettings.Landscape = true;
printerSettings.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Label", 300, 200);
doc.Print(printerSettings);
}

private void InsertBarcodeImage(Document doc, BarCodeBuilder barCode)
{
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToMergeField("Source");
builder.InsertImage(barCode.BarCodeImage);
}

Changing printer settings to to landscape had no effect. Specifying my paper dimension have no effect either. The template in use has its layout configured to 3" x 2". I've even bypassed the printer settings altogether and just called doc.Print("Printer Name") directly; same result. Attached is my template as well. I must be missing something.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I managed to reproduce the problem on my side and create new issue #8010 in our defect database. I will notify you as soon as it is fixed.

Best regards.

Will this come in the form of a hotfix? What do you think the turnaround time on this patch would be? If it is going to be a while, I need to come up with a temporary solution for printing these docs. What I don’t want to do is install Word or Word Viewer on the server just so I can print.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. The issue will be fixed in one of future releases. Unfortunately, I cannot provide you any reliable estimate regarding this issue at current stage. Please expect a reply before the next hotfix (within 3-4 weeks).

I cannot suggest you any workaround of this issue.

Best regards.

I wanted to follow up on this issue as 4 weeks have past. Do you know of a hotfix that is coming shortly?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Unfortunately, the issue is still unresolved.

Best regards.

The issues you have found earlier (filed as 8010) have been fixed in this update.

Would anyone please provide the correct code and steps to specify paper size? Thank you.


1. Create custom paper size in Windows=>Printer Settings=>Preferences
2. Follow the following code
Document doc = new Document(Application.StartupPath + “\test2.doc”);
Aspose.Words.Rendering.AsposeWordsPrintDocument asposDoc = new Aspose.Words.Rendering.AsposeWordsPrintDocument(doc);
asposDoc.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize(“Custom Size”, 300, 457);
asposDoc.DefaultPageSettings.Landscape = false;
asposDoc.PrintController = new StandardPrintController();

if (asposDoc.DefaultPageSettings.PaperSize.Kind == PaperKind.Custom)
{
asposDoc.DefaultPageSettings.PaperSize.RawKind = 0;
asposDoc.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize(“Custom Size”, 300, 457);
}
asposDoc.Print();

Will fail.
I am using evaluation version. Does this matter? Because it adds some evaluation text at the beginning of my document.

Hi

Thanks for your inquiry. Maybe in your case it would be enough to specify custom paper size in PageSetup of each section in your document. You can use PageWidth and PageHeight properties to achieve this:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.pagesetup.pagewidth.html

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.pagesetup.pageheight.html

Hope this helps.

Best regards,