Print margins on report

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Print margins on report

    Has anyone ever figured out why the print margins fluxuate on the PC-DMIS reports? Sometimes the bottom margins are 1 inch, but more often, it's something like 3 inches and it's VERY clear that another 2 or 3 dimensions can fit on that page.

    It's really frustrating seeing all these reports that can very easily be 1-3 pages shorter if we could the margins were set to 1" or .75". Running 3.7MR2, but this has been a problem since 3.6MR1 I believe.


    Thanks,
    Jim

  • #2
    I'd like to know too. If you print it as an .rtf it will be the same. The perplexing part is it displays fine be it an .rtf opened with Wordpad or the actual edit window report but as soon as you print the thing it is messed up.

    Craig
    <internet bumper sticker goes here>

    Comment


    • #3
      The margins Pcdmis uses has been a problem since V3.2063, reeally. They have always been OUTSIDE my printers margins limits, when saved to a RTF file. I have an HP printer, the most common printer out there, and Pcdmis can not stay within the printer parameters? And, printing direct to the printer is even worse, has been forever, that I can recall (except for DOS Pcdmis, it was OK). Also, there is nothing you can do about it, except go to V4.1, in which case, YOU will ahve to make-up your own custom reports for every program. It no longer works the (crappy) way you are used to, it is even worse, IMO. There are templates you can alter to come up with something that works and that you can use for all your programs, but crap-on-a-stick, whyinthehell can't Pcdmis just make a simple, straight-forward DOC file? Why can't the users set the margins, etc., that we want Pcdmis to use? This complaint (I think) is one of the reasons they went with this hyper-report-wanna-be method of reporting they have in V4+. All it does, as far as I can see, is make it take longer (and longer and longer) for us to get a simple, clean, black-and-white report. Annoying to say the very least.
      sigpic
      Originally posted by AndersI
      I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

      Comment


      • #4
        Speaking of which... can you change the color output on the report only when it goes to the printer? I want it the default way on the screen but when it goes to the printer can it be changed to just black and white?

        I know that you can change the printer to just black and white, but it tries to gray-scale the output and the green colored font is very light.
        Links to my utilities for PCDMIS

        Comment


        • #5
          Actually I created a VB app that takes the .rtf and makes a string out of it then prints it. I made it so you can set the margins and font. Here is the kicker, it still prints with a huge empty spot at the bottom so it is not a margin it is something in the string. I am going to see what it is when I get a chance but it is not high on my list. My latest problem is trying to keep color formating of text with the VB app. I want to print out tol in red (keep the color format) but I have not figured that out yet. I'll probably just automate Word to print it but that does not change the huge empty space. If it is in fact spaces I'll trim the string, that should solve it.

          Craig
          <internet bumper sticker goes here>

          Comment


          • #6
            Really sucks when you have to spend all this time to program in visual basic what you can do VERY easily in just about every other piece of software on the planet.

            I guess that's why PC-DMIS is so cheap. Oh wait, it's not. n/m.

            Comment


            • #7
              Originally posted by craiger_ny View Post
              Actually I created a VB app that takes the .rtf and makes a string out of it then prints it. I made it so you can set the margins and font. Here is the kicker, it still prints with a huge empty spot at the bottom so it is not a margin it is something in the string. I am going to see what it is when I get a chance but it is not high on my list. My latest problem is trying to keep color formating of text with the VB app. I want to print out tol in red (keep the color format) but I have not figured that out yet. I'll probably just automate Word to print it but that does not change the huge empty space. If it is in fact spaces I'll trim the string, that should solve it.

              Craig


              Open the RTF file in a DOS command prompt window using EDIT

              EDIT filename.rtf

              This will show you all the RTF code that Pcdmis is putting into the file, it might show you what you need to see. Of course, you have probably already done this, but, back in the DOS days, I had to open and edit these files, so I got to see all this code and was able to remove colrs, change colors, etc. As you can see, there is code for margins and many other things. If I remember right, when I was editing those things back in the DOS days, I was removing the /PAR from all liines and removing all the header code as well.


              Last edited by Matthew D. Hoedeman; 02-21-2007, 01:31 PM.
              sigpic
              Originally posted by AndersI
              I've got one from September 2006 (bug ticket) which has finally been fixed in 2013.

              Comment


              • #8
                Do you process the actual RTF file?

                Are there codes for the color red in RTF?

                I did this with VB but used text in a picture box so that I could control the text color as I added it to the picture box. Here is the code for the picture box that loops through the text file.

                Code:
                Sub PrintDataToScreen()
                    Dim s As String
                    On Error GoTo FileError
                    Open Paths.LastPart & "LastReport_" & iStationSelected & ".txt" For Input As #15
                   
                    Do Until EOF(15)
                        Line Input #15, s
                        If InStr(1, s, "*OUT*") Then
                            s = Left(s, Len(s) - 5)
                            frmLastResult.picResults.ForeColor = vbRed
                        Else
                            frmLastResult.picResults.ForeColor = vbBlack
                        End If
                        frmLastResult.picResults.Print s
                '        picResults.Refresh
                        
                    Loop
                    
                    Close #15
                
                '    picResults.Refresh
                    Exit Sub
                FileError:
                    Close #15
                On Error GoTo 0
                    frmLastResult.picResults.Print "Error showing data"
                
                End Sub

                The picture box is then printable.
                Links to my utilities for PCDMIS

                Comment


                • #9
                  I'm using an .rtf box in a VB app to display the .rtf that PCDMIS spits out. I do that so that my app looks just like the edit window results as that is how folks are acustomed to seeing it. I think I should be able to incorporate what you are doing. thanks
                  <internet bumper sticker goes here>

                  Comment


                  • #10
                    Doesnt the RTF window recognize the colors in the RTF? an ddisplay them properly?
                    Links to my utilities for PCDMIS

                    Comment


                    • #11
                      Yes they are displayed properly but printing is another issue, I need to get a handle on the printing thing. It is new to me so this is self inflicted I'm printing the string that is in the .rtf box. That is not good enough as it is what I say a string. It is not like I am printing the ".rtf box" itself.
                      <internet bumper sticker goes here>

                      Comment


                      • #12
                        Are you using the printer object? How are you sending this to the printer?
                        Links to my utilities for PCDMIS

                        Comment


                        • #13
                          Form variables:

                          Code:
                              Private PrintPageSettings As PageSettings
                              Private strToPrint As String
                              Private PrintFont As New Font("Courier New", 9)
                          Print button event:

                          Code:
                              Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
                          
                                  Try
                                      PrintDocResults.DefaultPageSettings = PrintPageSettings
                                      strToPrint = rtfResults.Text
                                      PrintDialog1.Document = PrintDocResults
                                      Dim result As DialogResult = PrintDialog1.ShowDialog
                                      If result = Windows.Forms.DialogResult.OK Then
                                          PrintDocResults.Print()
                                      End If
                          
                                  Catch ex As Exception
                                      MessageBox.Show(ex.Message)
                                  End Try
                          
                              End Sub
                          Print Document:

                          Code:
                              Private Sub PrintDocResults_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocResults.PrintPage
                          
                                  Dim intNumChars As Integer
                                  Dim intNumLines As Integer
                                  Dim strForPage As String
                                  Dim strFormat As New StringFormat
                                  Dim rectDraw As New RectangleF(e.PageBounds.Left + 20, e.PageBounds.Top + 50, e.PageBounds.Width - 40, e.PageBounds.Height - 100)
                                  Dim sizeMeasure As New SizeF(e.MarginBounds.Width, e.MarginBounds.Height - PrintFont.GetHeight(e.Graphics))
                          
                                  strFormat.Trimming = StringTrimming.Word
                                  e.Graphics.MeasureString(strToPrint, PrintFont, sizeMeasure, strFormat, intNumChars, intNumLines)
                                  strForPage = strToPrint.Substring(0, intNumChars)
                                  e.Graphics.DrawString(strForPage, PrintFont, Brushes.Black, rectDraw, strFormat)
                                  If intNumChars < strToPrint.Length Then
                                      strToPrint = strToPrint.Substring(intNumChars)
                                      e.HasMorePages = True
                                  Else
                                      e.HasMorePages = False
                                      strToPrint = rtfResults.Text
                                  End If
                          
                              End Sub
                          This is all for constant font size and margins. Variables can be used in the public font declaration and in the e.PageBounds properties. I am not in this case.

                          Craig
                          <internet bumper sticker goes here>

                          Comment


                          • #14
                            I am trying to determine if VB 6 is easier than .net with this.

                            I need to play with .net, there are so many more keywords, etc...
                            Links to my utilities for PCDMIS

                            Comment

                            Related Topics

                            Collapse

                            Working...
                            X