Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6235961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:45:59+00:00 2026-05-24T10:45:59+00:00

Goal: Create a reciept in a4 size pdf in WPF problem: Don’t know how

  • 0

Goal:
Create a reciept in a4 size pdf in WPF

problem:
Don’t know how to implement an across line in the document. That document will be created as a pdf file.

I know how to create and implement some text and picture that should be applied in the document but not a line.

enter image description here
This picture above this text do not have a across line in the sourcecode. Again, how do i create an across line between rows?

// Fullmetalboy

namespace MediaStore.MenuCheckout
{
    /// <summary>
    /// Interaction logic for Reciept.xaml
    /// </summary>
    public partial class Reciept : UserControl
    {

        private Testt _Testt;
        private ManagerCart _myManagerCart;
        private ManagerProduct_SaleAndProductQuantity _myManagerProduct_SaleAndProductQuantity;

        public Reciept(Testt pTestt, ManagerCart pManagerCart, ManagerProduct_SaleAndProductQuantity pManagerProduct_SaleAndProductQuantity)
        {
            InitializeComponent();

            _Testt = pTestt;

            _myManagerCart = pManagerCart;
            _myManagerProduct_SaleAndProductQuantity = pManagerProduct_SaleAndProductQuantity;
        }

        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            _Testt.Close();
        }


        private int _header1 = 75;
        private int _header2 = 200;
        private int _header3 = 280;
        private int _header4 = 480;
        private int _header5 = 570;
        private int _rowY = 60;


        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {

            PrintDialog myPrintDialog = new PrintDialog();

            if (myPrintDialog.ShowDialog() == true)
            {
                // Create a myDrawingVisual for the page.
                DrawingVisual myDrawingVisual = new DrawingVisual();

                // Get the drawing context
                using (DrawingContext myDrawingContext = myDrawingVisual.RenderOpen())
                {

                    // Create headline

                    FormattedText headArticleNumber = new FormattedText("Article number", CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                               new Typeface("Verdana"), 12, Brushes.Black);

                    FormattedText headQuantity = new FormattedText("Quantity", CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                    new Typeface("Verdana"), 12, Brushes.Black);

                    FormattedText headName = new FormattedText("Name", CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                            new Typeface("Verdana"), 12, Brushes.Black);

                    FormattedText headPriceQTY = new FormattedText("Price/QTY", CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                   new Typeface("Verdana"), 12, Brushes.Black);

                    FormattedText headSum = new FormattedText("Sum", CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                               new Typeface("Verdana"), 12, Brushes.Black);





                    Point myPoint1 = new Point(_header1, _rowY);
                    Point myPoint2 = new Point(_header2, _rowY);
                    Point myPoint3 = new Point(_header3, _rowY);
                    Point myPoint4 = new Point(_header4, _rowY);
                    Point myPoint5 = new Point(_header5, _rowY);

                    // Draw the content.
                    myDrawingContext.DrawText(headArticleNumber, myPoint1);
                    myDrawingContext.DrawText(headQuantity, myPoint2);
                    myDrawingContext.DrawText(headName, myPoint3);
                    myDrawingContext.DrawText(headPriceQTY, myPoint4);
                    myDrawingContext.DrawText(headSum, myPoint5);



                    foreach(var a in _myManagerCart.GetAllProductFromCartList())
                    {
                        FormattedText articleNumber = new FormattedText(a._articleNumber.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                         new Typeface("Verdana"), 12, Brushes.Black);  

                        FormattedText name = new FormattedText(a._name, CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                new Typeface("Verdana"), 12, Brushes.Black);  

                        FormattedText price = new FormattedText(a._price.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                 new Typeface("Verdana"), 12, Brushes.Black);  

                        FormattedText quantity = new FormattedText(a._quantity.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                    new Typeface("Verdana"), 12, Brushes.Black);  

                        FormattedText sum = new FormattedText(a._sum.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                               new Typeface("Verdana"), 12, Brushes.Black);


                        _rowY = _rowY + 60;

                        myPoint1 = new Point(_header1, _rowY);
                        myPoint2 = new Point(_header2, _rowY);
                        myPoint3 = new Point(_header3, _rowY);
                        myPoint4 = new Point(_header4, _rowY);
                        myPoint5 = new Point(_header5, _rowY);

                        myDrawingContext.DrawText(articleNumber, myPoint1);
                        myDrawingContext.DrawText(quantity, myPoint2);
                        myDrawingContext.DrawText(name, myPoint3);
                        myDrawingContext.DrawText(price, myPoint4);
                        myDrawingContext.DrawText(sum, myPoint5);
                    }


                    SalesTrans mySalesTrans = _myManagerProduct_SaleAndProductQuantity.RetrieveLatestReceiptInfo();

                    FormattedText totalCost = new FormattedText("Total cost: " + mySalesTrans._totalCost.ToString() + " dollar", CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                new Typeface("Verdana"), 14, Brushes.Black);

                    totalCost.SetFontWeight(FontWeights.Bold);


                    FormattedText receiptNumber = new FormattedText("Reciept number: " + mySalesTrans._receiptNumber.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                    new Typeface("Verdana"), 12, Brushes.Black);

                    FormattedText salesDate = new FormattedText("Date: " + mySalesTrans._salesDate.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                                                                new Typeface("Verdana"), 12, Brushes.Black);


                    Point myPoint = new Point(_header5, _rowY + 80);
                    myDrawingContext.DrawText(totalCost, myPoint);

                    myPoint = new Point(_header5, _rowY + 120);
                    myDrawingContext.DrawText(receiptNumber, myPoint);

                    myPoint = new Point(_header5, _rowY + 160);
                    myDrawingContext.DrawText(salesDate, myPoint);

                    int sdf = 23;


                }

                // Print the myDrawingVisual.
                myPrintDialog.PrintVisual(myDrawingVisual, "Receipt");
            }


        }


    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:46:00+00:00Added an answer on May 24, 2026 at 10:46 am

    Here’s the Basic Drawing in WPF Overview

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Goal: create webservice that will query database and return rows, then pass it to
My goal is to create a Web Service client that runs in a standalone
My goal is to create a reusable Attached Behavior for a FlowDocumentScrollViewer, so that
Can't get this to work. Goal is to create a overflowing scrollable div that
My goal is to create an animation with the YUI Animation Utility that does
My goal is to create some kind of swing component that can do two
My goal is to create an Excel 2007 document (XLSX) in an Eclipse RCP
My goal is to create an eBook that I can read with the Mobipocket
My goal is to create a solid line between certain columns of a Grid.
My goal is to create a validated IP address field that will be validated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.