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 4108892
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:43:10+00:00 2026-05-20T21:43:10+00:00

I have to print a custom label to a thermal printer. I have everything

  • 0

I have to print a custom label to a thermal printer. I have everything setup and working with one exception: the rolls of labels have two labels per row, but the C# printing objects can’t seem to see that.

When I query the PageSize information, it tells me that the label is 3.15″ x 0.75″. While this is true for the entire label, it doesn’t give me any information about the size of each individual label, or the spacing between.

Digging into the driver ini files, there is a line that looks like PageSize84 = THT-6-423,3150,2,1500,750,150,125,1. All of the information I need seems to be listed in this line (2 columns, 1500 wide, 750 tall), I just have no idea how to access it from C#. I’ve been scouring the web today, and I’ve had no luck.

I could always hard code the information for now, but this doesn’t future proof the code if manufacturing changes labels.

  • 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-20T21:43:11+00:00Added an answer on May 20, 2026 at 9:43 pm

    If you are trying to read an ini file to get the values you can use this.

    IniFile.ReadIniValue(“[Tag]”, “Server”, @”C:\my.ini”);

    #region Usings
    
    using System.Text;
    using System.Runtime.InteropServices;
    #endregion
    
    /// <summary>
    /// Communicates with ini files
    /// </summary>
    public static class IniFile
    {
        #region Declarations
    
    
    
        #endregion
    
        #region Constructor/Deconstructor
    
        /// <summary>
        /// Initializes a new instance of the <see cref="IniFile"/> class.
        /// </summary>
        static IniFile()
        {
        }
    
        #endregion
    
        #region Properties
    
    
    
        #endregion
    
        #region Win32_API
    
        [DllImport("kernel32")]
        private static extern int GetPrivateProfileString(
            string section,
            string key, string def,
            StringBuilder retVal,
            int size, string filePath);
    
        [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        static extern bool WritePrivateProfileString(string lpAppName,
           string lpKeyName, string lpString, string lpFileName);
    
        #endregion
    
        /// <summary>
        /// Reads the ini value.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="key">The key.</param>
        /// <param name="iniFilePath">The ini file path.</param>
        /// <returns>Value stored in key</returns>
        /// <exception cref="FileNotFoundException"></exception>
        public static string ReadIniValue(string section, string key, string iniFilePath)
        {
            if(!File.Exists(iniFilePath))
            {
                throw new FileNotFoundException();
            }
    
            const int size = 255;
            var buffer = new StringBuilder(size);
            var len = GetPrivateProfileString(section, key, string.Empty, buffer, size, iniFilePath);
    
            if (len > 0)
            {
                return buffer.ToString();
            }
            return string.Empty;
        }
    
        /// <summary>
        /// Writes the ini value.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="keyname">The keyname.</param>
        /// <param name="valueToWrite">The value to write.</param>
        /// <param name="iniFilePath">The ini file path.</param>
        /// <returns>true if write was successful, false otherwise</returns>
        public static bool WriteIniValue(string section,string keyname,string valueToWrite,string iniFilePath)
        {
            return WritePrivateProfileString(section, keyname, valueToWrite, iniFilePath);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a simple WPF print dialog box to setup a label printer. I
I have print $str; abcd*%1234$sdfsd..#d The string would always have only one continuous stretch
I have a custom label in a winform app. I change the content of
In Contacts I have set up a Date field with a custom label (when
I have a label label1 in the middle left of a large custom panel
I have to print shipping labels for the products our company manufactures. To help
I've added a custom border to the labels in one of my application forms
In my installer I have set WixUIBannerBmp to point to my own custom dialog-banner.bmp
I have a situation where I have to print out a NUL character if
if for example i have : #define PRINT(x) fprintf(stderr, x); and in code i

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.