Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

DDT-PB9 PDF View 0.10, a PDF viewer

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

  • PBWin DDT-PB9 PDF View 0.10, a PDF viewer

    New release,

    PDF View is a PowerBASIC PDF file viewer. The project is completely done in DDT and uses the the Quick PDF library.

    To compile and run the attached code you'll need an unlock code, the DLL and the include file. To run the included exe you'll only need the Quick PDF DLL. You can get all three items by downloading the Quick PDF trial version from:

    http://www.quickpdflibrary.com/produ...kpdf/trial.php

    Changes in this release:

    '.Apr 11, 2009 - Version 0.10 by Marc Giao
    '....Added scroll bars
    '....Added full screen button
    '....Added status bar
    '....Added minimum resizing limits
    '....Zoom now goes to 3x
    '....Page now centres on the screen

    Some notes on this release. The Scrollbars are done entirely in DDT. I am not entirely happy with the page range values but I've been short on time so the fine tuning will have to wait until next release. Also, there's a strange visual effect with the "Page Range" field when the dialog is very slowly resized horizontally, again, next time.

    Starting with this release, I'll keep the code and exe in separate zip files, PDFView_DLL and PDFView_EXE respectively.

    Changes in this release:

    '.Apr 26, 2009 - Version 0.30 by Marc Giao
    '....Changed project name to "Open View"
    '....Added multiple open files option
    '....Added option to open additional file formats (jpg, bmp, png, etc)
    '....Added go to page option
    '....%APPDATA% directory is now used for all data files
    '....Improved scrollbars
    '....Fixed printing issue repoted by Hans Rietveld
    '....Fixed issue with landscape files
    '....fixed misc. other minor issues

    I hope you find this project useful, educational or entertaining. For discussion on this project please use the following thread:

    http://www.powerbasic.com/support/pb...722#post313722

    Code and Comments are welcome.
    Attached Files
    Last edited by Marc Giao; 26 Apr 2009, 09:59 PM.
    Regards,
    Marc

  • #2
    Marc.

    Thank you for this contribution of the updated and extended program.
    You have made it to a full product, which can be a skilful tool for a lot of people.
    The sourcecode may be an incentive to some readers to begin writing a program.

    Marc thanks.
    sigpic
    Regards,
    Hans Rietveld.

    Comment


    • #3
      Hallo Marc.

      There is a little error in the printfunction.
      Changing the printer doesn't work.

      Here is an updated version of the printerfunction.

      Please add this GLOBAL at the begin of the program.

      GLOBAL PrintSel AS STRING ' Name of selected printer

      Code:
          ' retrieve default printer name
                  XPRINT ATTACH DEFAULT ' capture default printer
                  PrintSel = XPRINT$
                  CONTROL SET TEXT CB.HNDL, %Printer, PrintSel
                  XPRINT CLOSE          ' release printer

      Code:
      CALLBACK FUNCTION OnEvent_Print( ) AS LONG
      '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      ' contributed by Hans Rietveld
      ' page range selection add by Marc Giao
      '
      LOCAL Result    AS LONG   ' function return result
      LOCAL NF        AS LONG   ' number of range fields
      LOCAL SP        AS LONG   ' start page number
      LOCAL EP        AS LONG   ' end page number
      LOCAL X         AS LONG   ' index
      LOCAL PR        AS STRING ' range of pages to print
      LOCAL Txt       AS STRING
      
      IF CB.MSG = %WM_COMMAND AND CB.CTLMSG = %BN_CLICKED THEN
          SELECT CASE CB.CTL
              CASE %PrintAll
                  CONTROL SET TEXT CB.HNDL, %PageRange, "ALL"
              CASE %PrintOdd
                  CONTROL SET TEXT CB.HNDL, %PageRange, "ODD"
              CASE %PrintEven
                  CONTROL SET TEXT CB.HNDL, %PageRange, "EVEN"
              CASE %PrintSetup
              ' original code by Hans Rietveld, modified by Marc Giao
                  XPRINT ATTACH CHOOSE
      
                  IF TRIM$( XPRINT$ ) = "" THEN
                      XPRINT ATTACH DEFAULT
                  END IF
      
                  PrintSel = XPRINT$
                  CONTROL SET TEXT CB.HNDL, %Printer, PrintSel
                  XPRINT CLOSE
      
              CASE %PrintPDF
                  CONTROL GET TEXT CB.HNDL, %PageRange TO PR
                      SELECT CASE PR
                          CASE ""
                              EXIT FUNCTION
      
                          CASE "ALL"
                              SP = 1
                              EP = QuickPDFPageCount( LibInstance )
                              XPRINT ATTACH PrintSel
                              CONTROL SET TEXT CB.HNDL, %PageRange, "Printing:" + STR$(EP) + " Pages"
                              Result = QuickPDFPrintDocument( LibInstance, PrintSel & $NUL, SP, EP, 0 )
                              XPRINT CLOSE
      
                          CASE "ODD"
                              SP = 1
                              EP = QuickPDFPageCount( LibInstance )
                              XPRINT ATTACH PrintSel
                              FOR X = 1 TO EP STEP 2
                                  CONTROL SET TEXT CB.HNDL, %PageRange, "Printing Page:" + STR$( X )
                                  Result = QuickPDFPrintDocument( LibInstance, PrintSel & $NUL, X, X, 0 )
                              NEXT
                              XPRINT CLOSE
      
                          CASE "EVEN"
                              SP = 2
                              EP = QuickPDFPageCount( LibInstance )
                              XPRINT ATTACH PrintSel
                              FOR X = 2 TO EP STEP 2
                                  CONTROL SET TEXT CB.HNDL, %PageRange, "Printing Page:" + STR$( X )
                                  Result = QuickPDFPrintDocument( LibInstance, PrintSel & $NUL, X, X, 0 )
                              NEXT
                              XPRINT CLOSE
      
                          CASE ELSE
                              PR = RETAIN$( PR, ANY "-,1234567890" )
                              IF PR = "" THEN EXIT FUNCTION
                              NF = PARSECOUNT( PR, "," )
                              DIM PP( 1 TO NF ) AS STRING ' array of pages to print
                              PARSE PR, PP( )
                              XPRINT ATTACH PrintSel
                              FOR X = 1 TO NF
                                  IF PP( X ) = "" THEN ITERATE
                                  IF PARSECOUNT( PP( X ), "-" ) THEN
                                      SP = VAL( PARSE$( PP( X ), "-", 1 ) )
                                      EP = VAL( PARSE$( PP( X ), "-", 2 ) )
                                      CONTROL SET TEXT CB.HNDL, %PageRange, "Printing:" + STR$(SP) + " to" + STR$(EP)
                                  ELSE
                                      SP = VAL( PP( X ) ) : EP = SP
                                      CONTROL SET TEXT CB.HNDL, %PageRange, "Printing Page: " + STR$(SP)
                                  END IF
                                  Result = QuickPDFPrintDocument( LibInstance, PrintSel & $NUL, SP, EP, 0 )
      
                              NEXT
                              XPRINT CLOSE
      
              END SELECT
          END SELECT
      
      FUNCTION = 1
      
      END IF
      
      END FUNCTION ' OnEvent_Print
      I'am pleased with your prgram, I use it daily.
      sigpic
      Regards,
      Hans Rietveld.

      Comment


      • #4
        Hi Hans,

        Thanks for reporting, that was silly of me

        I fixed it fifferently to avoid another global... don't want to cross paths with the "Global Police" :laugh:

        Anyway, I've posted an update with some more goodies. Hope you find it useful.
        Regards,
        Marc

        Comment


        • #5
          Hi Marc.

          It is even better now.
          I like the new startup screen.

          I fixed it fifferently to avoid another global... don't want to cross paths with the "Global Police"
          You're right, it's better so.

          Could you change:
          "Even", 950, 225, 43, 15,, CALL OnEvent_Print( )
          I'am missing the last part of the letter "n".

          May be you could add an option to save the current page of the document in a different file type.
          Looks handy to me.

          You could use for this function:

          Code:
          int QuickPDFRenderPageToFile(int InstanceID, int DPI, int Page,
          int Options, char * FileName) 
          
          int QuickPDFSetJPEGQuality(int InstanceID, int Quality)
          sigpic
          Regards,
          Hans Rietveld.

          Comment


          • #6
            Just a minor update, nothing new

            '.May 3, 2009 - Version 0.40 by Marc Giao
            '....Compiled wirh new trial license
            '....Open file dialog now remembers previous path
            '....Tweaks to page display and position
            '....Tweaks to display colour
            '....Tweaks to text positions

            I hope you find this project useful, educational or entertaining. For discussion on this project please use the following thread:

            http://www.powerbasic.com/support/pb...722#post313722

            Code and Comments are welcome.
            Attached Files
            Regards,
            Marc

            Comment


            • #7
              Vers 12 Download

              Can't seem to find this DL- only current vers 15 which doesn't work with your exe.

              Thx,

              Jim

              Comment


              • #8
                Hi Jim,

                Ver 7.12 is history but you may still find a release here: http://www.quickpdf.org/forum/librar...s_forum18.html

                Better to download 7.15 and recompile the project using a new 30 day trial key. The trial key used in the above projects has since expired... When summer is over I'll try and recompile the project with a permanent key.

                If you want to discuss further please do so at: http://www.powerbasic.com/support/pb...722#post313722
                Last edited by Marc Giao; 6 Sep 2009, 12:36 PM. Reason: added more info
                Regards,
                Marc

                Comment

                Working...
                X