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, a viewer for PDF files

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

  • DDT-PB9 PDF View, a viewer for PDF files

    PDF View is a PDF viewer for PowerBASIC 9.01. The attached code is 100% DDT and bloat free

    The executable is under 50K and the necessary Quick PDF DLL is under 1.5 Meg. The Adobe Reader 8.1.3 folder on my machine weighs in at 195 Meg but then, this project also doesn't have the functionality or features that Adobe Reader 8 has.

    The project has been tested with the following files:

    1 - The included "PDF_Report.pdf" (1 page)
    2 - The "GettingStarted.pdf" (2 pages) in the bata 2 version of Quick PDF 7.12
    3 - The PDF reference manual (200+ pages) from the Quick PDF 5.11 demo version
    4 - The PDF reference manual (500+ pages) from the Quick PDF 7.12 beta 2 release
    5 - PowerBASIC Test Forums, post by Gordon Slater (1 page) http://www.powerbasic.com/support/pb...ad.php?t=40104
    6 - Inlet Manifold An Alibre Design Tutorial (43 pages) http://www.instructables.com/files/o...N0EQHOAMC1.pdf
    7 - Perfect Sync's SQL Tools Help File (910 pages) http://perfectsync.com/dl/SQLTools.pdf
    8 - Ditra, A Tile Floor that Won’t Crack (7 pages) http://www.schluter.com/media/articl...e_floor_us.pdf

    Files 1 to 6 all loaded fine and seem to display correctly. File 7 loads fine and displays correctly except for the logo missing from the first page.

    File 8 is a challenge. File loading is slow, the first page rendering is slow others are fine. The document has many embedded fonts and none are showing.

    Feel free to comment and contribute to the project, I'll open a new topic with the same name in the third-party addons forum.

    http://www.powerbasic.com/support/pb...768#post311768
    Attached Files
    Last edited by Marc Giao; 22 Mar 2009, 08:25 PM. Reason: Updated code attachment
    Regards,
    Marc

  • #2
    Update code uploaded

    Just update the code on the first post.

    What's new:
    ' Mar 22, 2009 - Version 0.05 by Marc Giao
    ' Added some error checking
    ' Added printing (with input from Hans Rietveld)
    ' Added window resizing
    If you compile the code, you'll need an unlock code and the PowerBASIC include file. You can get one by downloading the trial demo from here:

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

    To run the compiled program, your own or the one include, you'll also need the "Quick PDF Library DLL" included with the trial demo above.

    Code and comments welcome
    Regards,
    Marc

    Comment


    • #3
      Hi Marc.

      A small add-on to make "Set Up" working.

      Code:
      [COLOR="Silver"]GLOBAL LibInstance  AS LONG
      GLOBAL DocId        AS LONG[/COLOR]
      GLOBAL PrintSel     AS STRING ' Printer to use for printout
      And:

      Code:
      XPRINT ATTACH DEFAULT
      PrintSel = XPRINT$
      [COLOR="Silver"]DIALOG SHOW MODAL MainHndl&, CALL OnEvent_MainDlg [/COLOR]
      Replace XPRINT$ with PrintSel (4 times)

      And:

      Code:
             [COLOR="Silver"]CASE %PrintSetup[/COLOR]
                  XPRINT ATTACH CHOOSE
                  PrintSel = XPRINT$
                  IF TRIM$(PrintSel) = "" THEN
                      XPRINT ATTACH DEFAULT
                      PrintSel = XPRINT$
                  END IF
              [COLOR="Silver"]CASE %PrintPDF[/COLOR]
      sigpic
      Regards,
      Hans Rietveld.

      Comment


      • #4
        Hi Marc.

        You wrote

        Code and comments welcome
        The code is already in the posting above.

        Here is some comment.

        If you want to continue with the PDF Viewer, and I think that would be
        a good idea, I have the following suggestion.

        Why not change the library version for the activex version.
        The new compiler, PbWin9 has everything we always want to use those dll's.
        The library version that you are using now, depends on the includefile with is
        produced by Rowan.
        If he got to few response from the PBasic users, he might stop with producing
        this file. And this includefile could have some errors, as we have seen before.
        If you want to see how it is done, take a look at my earlier posting about this subject.
        If you want to change and need some help, just ask.

        The second comment is about my add on for printing.
        In this case I use the PBasic printerfunctions. I think this is the fastest and
        easiest way to do this job.
        On the other hand there is a build in function in QuickPDF to render the page
        to a device. It is the same function used to make the preview on the screen.
        In that case it is possible to use scaling for the printout, but is this usefull ?
        And then there is one small issue to solve, the DPI from the screen is much
        lower than the DPI from the printer.
        Some calculation must be done to keep the same size.

        I have done this already and the results are good, not better.
        So if you want to know more, ask again.

        Keep on going with the PDF Viewer.

        Hans Rietveld.
        sigpic
        Regards,
        Hans Rietveld.

        Comment


        • #5
          Add selected printer to the info window.

          Add to the 4th case statement in: CALLBACK FUNCTION OnEvent_Print( ) AS LONG

          Code:
           [COLOR="Silver"]               PrintSel = XPRINT$
                      END IF[/COLOR]
                      CONTROL SET TEXT CB.HNDL, %StateLog, GetDocumentInfo( ) ' Update infoscreen
          [COLOR="silver"]        CASE %PrintPDF        [/COLOR]
          Add to function: FUNCTION GetDocumentInfo( ) AS STRING

          Code:
              [COLOR="Silver"]Info$ + = "  Height = " + STR$( QuickPDFPageHeight( LibInstance& ) ) + $CRLF[/COLOR]
              Info$ + = $CRLF + "Printer:" + $CRLF
              Info$ + = "  " + PrintSel + $CRLF
             [COLOR="silver"] FUNCTION = Info$ [/COLOR]
          sigpic
          Regards,
          Hans Rietveld.

          Comment


          • #6
            Great work

            Originally posted by Marc Giao View Post
            Just update the code on the first post.

            What's new:


            If you compile the code, you'll need an unlock code and the PowerBASIC include file. You can get one by downloading the trial demo from here:

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

            To run the compiled program, your own or the one include, you'll also need the "Quick PDF Library DLL" included with the trial demo above.

            Code and comments welcome
            You're doing some really awesome work here Marc, good work. Building a PDF viewer using PowerBASIC that eveyone can use is going to benefit heaps of people.
            Rowan
            __________________________________
            Quick PDF Library
            www.quickpdflibrary.com
            The Unrivaled PDF Developer Toolkit™

            Comment


            • #7
              Conflict found and fixed in sample code

              Hi, I downloaded this program so I could play with the Debenu PDF Library and found the sample code provided caused the DISPLAY OPENFILE command to crash.

              I found the global variable DocID in the sample program needed to be changed to avoid the crash. I changed mine to gDocId1 and that seemed to work.

              Evidently there must be a conflict with that variable when calling DISPLAY OPENFILE.

              The crash occurred sometimes when calling DISPLAY OPENFILE but mostly as soon as the open file dialog closed and the PDFView program started to execute.

              I'm running PBWin10.

              Hope this saves someone else some time.

              Ken

              Comment


              • #8
                Some highly relevant info ..
                If you compile the code, you'll need an unlock code and the PowerBASIC include file. You can get one by downloading the trial demo from here:
                From the linked page:

                The evaluation version is fully functional for 30 days after the date of first installation.
                You can hit the "Purchase Now" link and from that learn the a full license will cost you $499.00

                MCM
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment

                Working...
                X