Announcement

Collapse
No announcement yet.

Trouble with PB printing PDF files.

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

  • Trouble with PB printing PDF files.

    I am not understanding why PBCC doesn't generate a .PDF file that can be read by Adobe Reader. My little test program seems to work, but when I try to open the PDF file with Adobe Reader I get an error message that the file is damaged or not in PDF format. Here's what I am using. What am I doing wrong?
    Tim

    Code:
    #COMPILE EXE
    #DIM ALL
    
    FUNCTION PBMAIN () AS LONG
    DIM HWIN AS LONG
    DIM PNT AS STRING
    DIM FHNDL(1) AS LONG
    
    GRAPHIC WINDOW NEW "TITLE", 500, 30, 743, 967 TO hwin&
    XPRINT ATTACH CHOOSE
    XPRINT PREVIEW HWIN&, 0
    GRAPHIC SET FOCUS
    FONT NEW "courier new", 12,1,0,1,0 TO FHNDL(1)
    XPRINT SET FONT FHNDL(1)
    XPRINT TAB(10) "Four score and seven years ago our fathers brought forth,"
    XPRINT TAB(10) "upon this continent, a new nation, conceived in liberty,
    XPRINT TAB(10) "and dedicated to the proposition that all men are created equal."
    XPRINT CLOSE
    CON.FOCUS
    PRINT "DONE"
    WAITKEY$
    END FUNCTION

  • #2
    What printer driver are you selecting with the XPRINT ATTACH CHOOSE ?

    Comment


    • #3
      What file? Feeding .exe or .bas to Adobe?
      Dale

      Comment


      • #4
        When the printer window comes up from the "XPRINT ATTACH CHOOSE" line, I select "Microsoft Print to PDF" as my printer of choice.

        I'm not wanting to print a file - just the three lines of Lincoln's Gettysburg address.

        Comment


        • #5
          Just looked at your code.
          1. You need XPRINT PREVIEW CLOSE to redirect back to the actual printer.
          2. You need to repeat the print instructions after the preview is closed

          (Look at the example in Help under Contents - Printing - Print Preview - it uses a SUB to avoid having to repeat all the XPRINT lines)
          '
          Code:
          #COMPILE EXE
          #DIM ALL
          
          FUNCTION PBMAIN () AS LONG
          DIM HWIN AS LONG
          DIM PNT AS STRING
          DIM FHNDL(1) AS LONG
          
          GRAPHIC WINDOW NEW "TITLE", 500, 30, 743, 967 TO hwin&
          XPRINT ATTACH CHOOSE
          XPRINT PREVIEW HWIN&, 0
          
          FONT NEW "courier new", 12,1,0,1,0 TO FHNDL(1)
          XPRINT SET FONT FHNDL(1)
          
          XPRINT TAB(10) "Four score and seven years ago our fathers brought forth,"
          XPRINT TAB(10) "upon this continent, a new nation, conceived in liberty,
          XPRINT TAB(10) "and dedicated to the proposition that all men are created equal."
          XPRINT PREVIEW CLOSE
          
          XPRINT TAB(10) "Four score and seven years ago our fathers brought forth,"
          XPRINT TAB(10) "upon this continent, a new nation, conceived in liberty,
          XPRINT TAB(10) "and dedicated to the proposition that all men are created equal."
          XPRINT CLOSE
          
          PRINT "DONE"
          WAITKEY$
          END FUNCTION
          '

          Comment


          • #6
            Stuart,
            Thank you very much. I tried your code and it works fine.
            I'm needing to send information to a lawyer to set up a Trust. This will help greatly!
            Tim

            Comment

            Working...
            X