[go: up one dir, main page]

Menu

#207 Bus with printing using a printer script.

v1.0_(example)
open
nobody
1
2025-09-23
2025-08-16
No

Hi,

I create a printer script to print in landscape mode (setmode(2,2)

If I print directly on the printer, or in a pdf file, it's ok.
When I try to ptint using the script file, the first page is in portrait mode, and obviously is not ok. The other pages are ok.

Here is how I proceed :

      oPrinter := HPrinter():New()
      oPrinter:LoadScript(cScript+".out")
      oPrinter:EndDoc(cScript+".out")
      oPrinter:End()

I send you the script for testing purpose, and the pdfs ok and ko.

Thanks
A+

3 Attachments

Discussion

  • Wilfried Brunken

    Hello Alain,
    i have no success to print into a PDF.
    Please check the attached sample and complete, so that i can
    reproduce the Bug.

    With regards

    MNI TNX, 73 es 55 de

    WIlfried,DF7BE

     
  • Aupeix Alain

    Aupeix Alain - 2025-08-18

    Hi Wilfried,
    Thanks, but I don't understand why you're sending this ticket which is about column size in a browse.
    I will try to create a sample which demonstrate the bug.

    A+

     
  • Wilfried Brunken

    Hello Alain,
    my fault, here the sample for this ticket.

    With regards

    MNI TNX, 73 es 55 de

    Wilfried, DF7BE

     
  • Aupeix Alain

    Aupeix Alain - 2025-08-19

    Hi, Wilfried,
    I try your ticket, but it doesn't open the printer.

    If I comment the line : oPrinter:lpreview := .T., it opens the printer, and I can print on the laser, or print in a pdf. But, obviously, the bug concerning the first page in portrait mode instead of landscape is always here.

    There is a long time I haven't used Windows, and I don't know if it's possible, as under Linux, to print in a pdf. But the bug is always present when printing on a real printer, and I suppose and hope that with HwGUI Windows you're able to print this script on a printer. In this case you're perhaps able to see the bug, if it's the same as under linux.

    Thanks
    A+

     
  • Wilfried Brunken

    Hello Alain,
    i need some info about the format of the scipt file "alpha.out".
    First i thought, it is Post Script, i installed the GhostWriter and try to open the file.
    but only the pure text is displayed.

    Can you send more info (or some links in the Internet) ?
    Or another idea ?

    On Windows, i had no success to display the printout with Print2PDF.

    With the WinPRN sample the printout appears OK, but
    the WINPRN class has no method "LoadScript".
    By calling the method "StartDoc(), file dialog for the PDF file
    appeared and the PDF is created in the current directory.

    I think, the information of "alpha.out" is processed by the printer driver.

    With regards

    MNI TNX, 73 es 55 de

    Wilfried, DF7BE

     
  • Aupeix Alain

    Aupeix Alain - 2025-08-25

    Hi Wilfried,

    alpha.out has been created using hwgui, so I don't understand why you are not able to use it. For me, there is no problem, except the problem with script landscape, where the first page is in portrait.
    The problem is not a pdf problem, but an hwgui problem, as it occurs when printing in a pdf, or on the printer.
    Have you tried under linux ?
    Why are you trying to use WINPRN class ?
    INIT PRINTER oPrinter"
    Does this use WINPRN Class ?

    I think, the information of "alpha.out" is processed by the printer driver.
    * Probably, but when creating the script, it opens the print window, and if printing, there is not the default.
    * It occurs only when opening the script that we save with hwgui.

    If I have time, not for now, I will create a test program.

    A+

     
  • Wilfried Brunken

    Hello Alain,
    now continue the discussing:

    • Have you tried under linux ?
      I tried both, Windows (with Microsoft Print2Pdf) and Ubuntu, but
      the EndDoc() method does not start the printout on Windows,
      LINUX starts, but with your reported format bug on the first page.

    • Why are you trying to use WINPRN class ?
      The WINPRN class works also correct on Windows,
      see sample program WINPRN.PRG, so i want to check.
      See hwinprn.prg:
      METHOD New()
      ...
      ::oPrinter := HPrinter():New( cPrinter, .F., nFormType )
      ==> So the WINPRN class creates a HPRINTER object.
      After the printer dialog appeared, the print starts with
      the query to ask for the name of the PDF as target for
      the printout.

    • INIT PRINTER oPrinter
      Does this use WINPRN Class ?
      No, see guilib.ch:

    #xcommand INIT PRINTER <oprinter> ;
    [ NAME <cprinter> ]</cprinter> ;
    [ <lpixel: pixel=""> ]</lpixel:> ;
    => ;
    <oprinter> := HPrinter():New( <cprinter>,!<.lPixel.> )</cprinter></oprinter></oprinter>

    • If I have time, not for now, I will create a test program.
      I will wait for your new or modified sample program.

    But i cannot detect the setmode(2,2) method (for example in NEW() method or
    alpha.out), please explain.

    I'll continue looking for the bus while waiting for your
    answer.

    With regards

    MNI TNX, 73 es 55 de

    Wilfried, DF7BE

     
  • Wilfried Brunken

    Hello Alain,
    for experiment i added (Ubuntu)
    oPrinter:Preview()
    after
    oPrinter:LoadScript(cScript+".out")
    The internal HWGUI print preview apears,
    but all pages are not in landscape.
    So i must understand,
    how the script feature works.
    For next step i will check differences in
    hprinter.prg for GTK and Windows,
    before continuing bugfixing.
    On Windows, i added temporary
    an new method:

    METHOD StartDoc2() CLASS HPrinter
    LOCAL nRes
    ::hDC := ::hDCPrn

    nRes := Hwg_StartDoc( ::hDC, "HwGUIPrint" )

    RETURN nRes

    Before
    LoadScript()
    i added
    oprinter:StartDoc2()

    The query for PDF file name and the preview
    apears, but no data are printed out, only boxes
    and hear. also the PDF left empty again.

    With this post i will inform you
    about the recent state.

    With regards

    MNI TNX, 73 es 55 de

    Wilfried, DF7BE

     
  • Aupeix Alain

    Aupeix Alain - 2025-08-27

    Hi Wilfried,

    oPrinter:LoadScript(cScript+".out")
    The internal HWGUI print preview apears,
    but all pages are not in landscape.

    That's exactly the problem I have. The first page is in portrait, which is not ok, but the others are in landscape as desired. But I say that printing just when creating the script, all the pages are in landscape. The problem occurs only when printing (or creating a pdf) using the out file.

    For the pdf creation, I think it's a problem Windows. Under Linux, no problem.

    A+

     

    Last edit: Aupeix Alain 2025-08-27
  • Wilfried Brunken

    Hello Alain,
    i am very busy at this , so i will look for this ticket as soon as possible, SRI.
    If you have any ideas, i will check it prompt.
    Here i appended a file with some reports of analyising the problem on Windows,
    because there no contents appeared.

    With regards

    MNI TNX, 73 es 55 de

    Wilfried, DF7BE

     

Log in to post a comment.