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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:01:34+00:00 2026-05-16T15:01:34+00:00

I am runing a .bat file from a php using exec on a Windwos

  • 0

I am runing a .bat file from a php using exec on a Windwos php server, where php is run using fast-cgi (and nginx). The command line to run this script is

  pclose(popen("start / ". $cmd, "r"));  

Where $cmd is somethign like “mybatfile.bat 45 1”

When I run the batch file manually it runs a python program to read a database, get hold of some data, and print a little report. And it all works 100% correctly.

When it is run from the web page, the report comes out, so I know the program is run. The code logs the parameters passed. I know that the call is correct.

When run from the server/web page the report appears on the same printer approx 20% larger that when run from the coammnd line.

The python script uses PyQt and opens the printer in native mode.

The code is

    self.printer = QPrinter()
    self.printer.setPrinterName(printer)
    self.printer.setPageSize(QPrinter.A5)
    self.printer.setOrientation(QPrinter.Portrait)
    self.painter = QPainter(self.printer)

Does anyone know why this happens – and what can I do to correct it?

O/S is windows 7 (64 bit) for developement and a Server version for production.
Python 2.7 32 bit.
QT version 4.

Thanks
Ian

  • 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-16T15:01:34+00:00Added an answer on May 16, 2026 at 3:01 pm

    Cracked it!
    The user who is running the server has never logged in (naturally) so they have never changed their screen resolution from 90 dpi.

    I on the other hand, have changed by screen resolution because I use large fonts.
    So when I ran the print it printed in 120 dpi. When the server ran it, it printed in 90 dpi.

    Solution.

    After opening the printer, read the actual resolution back, and compute a scale factor.

    Use the scale factor for all layout and positioning – except font sizes in points which will be correct anyway.

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

Sidebar

Ask A Question

Stats

  • Questions 510k
  • Answers 511k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your .5 is coming about because you've set the default… May 16, 2026 at 5:09 pm
  • Editorial Team
    Editorial Team added an answer See this for an example of allowing only a specific… May 16, 2026 at 5:09 pm
  • Editorial Team
    Editorial Team added an answer this happens because Sortable doesn't really know if you are… May 16, 2026 at 5:09 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Can anyone tell me how to execute a .bat file from a PHP script?
I wanted to run a .cmd file from Java. I have something which works
I'm using Windows on my servers. I have to periodicly download some file to
I have a batch file that I have been using to install my C#
runing a select query on SQL Server 2008, sys.indexes gives me information on the
I'm trying to build the qtestlib/tutorial1 example , but the testqstring.moc file isn't being
I am running sql server 2008 express and i need to schedule some stored
I've started using Code Contracts in all new code I'm writing, such as in
I've set up a simple, single-service server which has been working just fine with
maybe this is a stupid question but : i run perl 5.8.8 and 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.