Page 1 of 2 12 LastLast
Results 1 to 40 of 46

Thread: PDF Reader ActiveX Control

  1. #1

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    PDF Reader ActiveX Control

    This is my first post! I am an old French VB6 programmer and you will forgive me for using Google translation furiously!

    I have needed an OCX PDF viewer for a long time.

    Olaf Schmidt made me discover PDFium.dll in the following post:
    http://www.vbforums.com/showthread.p...-ImageExports)

    Thank you Olaf!

    I made the draft of an ActiveX component PDF viewer which allows
    • View PDF files
    • Print PDF files
    • Extract the text content if it exists
    • Practice Character Recognition on the PDF file in conjunction with Tesseract-OCR, open-source OCR software under Apache 2.0 license (https://github.com/tesseract-ocr/tes...ster/README.md)

    Name:  PDFReader.jpg
Views: 6241
Size:  53.5 KB

    Like Olaf, I use the PDFium version 2018-04-08 / Pdfium-x86-no_v8-no_xfa available on the build service provided by Pieter van Ginkel on GitHub here: https://github.com/pvginkel/PdfiumBu...lds/2018-04-08

    As Olaf says: "PDFium (licensed under BSD by Google / Foxit) is the only PDF-reader / viewer-tool I know of, which can be used (and deployed) also in commercial Apps ..."
    PDFium.dll must be in the same directory as the ActiveX component
    The component has no other dependency than PDFium.dll and the common VB6 files

    For Tesseract OCR, Windows installer is available on the following Wiki: https://github.com/UB-Mannheim/tesseract/wiki
    I use the 32bit version

    A Doc.pdf file in the zip lists the events, methods and properties of the control

    Besides Olaf Schmidt, I thank LaVolpe, Dilettante, The Trick, Ellis Dee for their modules gleaned from CodeBank !

    PDFReader.zip

    NB: I wanted to thank all the contributors to this forum for their work, which makes it possible to maintain VB6 and to adapt it to Windows evolution. With additional thought for LaVolpe whose codes and tools accompany my work for so many years!

  2. #2
    Fanatic Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    538

    Re: PDF Reader ActiveX Control

    very good project and control.

    Greetings

  3. #3
    Fanatic Member
    Join Date
    Jan 2015
    Posts
    614

    Re: PDF Reader ActiveX Control

    Pas mal du tout.
    Quelques petits soucis quand on scroll un long PDF trop vite avec la molette, certaines pages ne sont pas affichées.

    And for the other
    Nice control.
    A minor bug when scrolling with the weel mouse oa long PDF. Some pages are not rendered

    So now, other can also learn french

  4. #4

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Merci Thierry,

    Cela est du au temps de conversion de la page PDF en bitmap par la dll PDFium. Je vais chercher à optimiser ça

    And for the other...
    This is due to the conversion time of the PDF page to bitmap by the PDFium dll. I'm going to try to optimize it

  5. #5
    Fanatic Member
    Join Date
    Jan 2015
    Posts
    614

    Re: PDF Reader ActiveX Control

    Saturnian, in this case, I suggest to start a new thread that convert in the background all the PDF to BMP

  6. #6
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Question Re: PDF Reader ActiveX Control

    I can't load any pdf file. Anybody, please, help me. Error #53 "File not found: PDFium".

    I have unzipped the PDFReader.zip archive and placed the pdfium.dll in the same folder. Then I have run the PDFReader.vbg and the main form was displayed successfully. But trying to load a file caused the error #53.
    I could not register the PDFium library, but, as I understand it, this is not necessary because of LoadLibraryW and FreeLibrary are used.

    What am I doing wrong? Shall I compile and/or register an OCX-file?
    I have never had a deal with project groups before. So I need help here.

  7. #7

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Hello Nouyana
    in what procedure and on which line does the error occur?

  8. #8
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by saturnian View Post
    Hello Nouyana
    in what procedure and on which line does the error occur?
    Bonjour saturnian! The only line.

    Private Sub Command2_Click()
    PDFReader1.SelectPDFFile App.Path
    End Sub


    Updated1:
    in my Error Trapping settings the "Break on Unhandled Errors" option is selected.

    Updated2:
    When I set the Error Trapping settings to "Break on All Errors" the error occurs on the last line:
    Public Function Load(ByVal FileName As String, Optional ShowPDF As Boolean = True) As Boolean
    Dim F As Integer, B() As Byte
    If Exist(FileName) Then
    If PDFLib = 0 Then 'If the PDFium library is not loaded, we load it and initialize it
    PDFLib = LoadLibraryW(StrPtr(App.Path & "\PDFium.dll"))
    FPDF_InitLibrary


    Updated3:
    The
    Debug.Print App.Path & "\PDFium.dll"
    line returns correct path.
    OS: WinXP, VB6 professional.
    Last edited by Nouyana; Jan 11th, 2020 at 02:03 PM.

  9. #9

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Nouyana
    Your PDFium version probably looks corrupt or not correct. Try reloading it and tell me if things get better

    NB you can use this mirror link www.ordoconcept.net/pdfium.dll
    this is the dll i use

  10. #10
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Exclamation Re: PDF Reader ActiveX Control

    Quote Originally Posted by saturnian View Post
    Nouyana
    Your PDFium version probably looks corrupt or not correct. Try reloading it and tell me if things get better
    NB you can use this mirror link www.ordoconcept.net/pdfium.dll
    this is the dll i use
    saturnian
    these DLLs are really have different md5 sums:

    But bouth are work fine under Win10. The problem is only under WinXp.

    So, I suppose that pdfium.dll doesn't work under Windows XP.

  11. #11

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Nouyana
    I have not worked under XP for a long time.

    Pieter van Ginkel on GitHub said : "the V8 version does not support Windows XP so if you need support for Windows XP, you need to choose one of the libraries that does not contain V8 support and include an updated version of the dbghelp libraries. These can be found in the Support\dbghelp directory."
    Have you tried to download this library? (see : https://github.com/pvginkel/PdfiumBuild )

  12. #12

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    I created a virtual machine under XP.
    In fact, I have not found a way to make PDFium work.
    Despite the claims, this dll does not seem compatible with XP, indeed

  13. #13
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Question Re: PDF Reader ActiveX Control

    Quote Originally Posted by saturnian View Post
    I created a virtual machine under XP.
    In fact, I have not found a way to make PDFium work.
    Despite the claims, this dll does not seem compatible with XP, indeed
    Maybe. Then what was Pieter van Ginkel talking about?
    Do you know what the phrase "include an updated version of the dbghelp libraries" means in relation to VB6? Maybe I need to rebuild the pdfium.dll project with dbghelp.dll included? Do you know how to do it?

  14. #14

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Nouyana, voici un lien sur un autre thread ou Olaf Scmidt donne des compléments d'information sur l'absence de support de PDFium sous XP :
    http://www.vbforums.com/showthread.p...=1#post5412903

  15. #15

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Nouyana, here is a link on another thread where Olaf Scmidt gives additional information on the lack of PDFium support in XP :
    http://www.vbforums.com/showthread.p...=1#post5412903

  16. #16
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by saturnian View Post
    Nouyana, here is a link on another thread where Olaf Scmidt gives additional information on the lack of PDFium support in XP :
    http://www.vbforums.com/showthread.p...=1#post5412903
    Thank you, saturnian!
    So I need someone who can rebuild the project and remove the dependencies on "ieshims.dll" and "wer.dll". It seems too complicated task for me.

    ieshims.dll is an artefact of Vista/7 where a shim DLL is used to proxy certain calls (such as CreateProcess) to handle protected mode IE, which doesn't exist on XP, so it is unnecessary. wer.dll is related to Windows Error Reporting and again is probably unused on Windows XP which has a slightly different error reporting system than Vista and above.

  17. #17
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,394

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by Nouyana View Post
    So I need someone who can rebuild the project and remove the dependencies on "ieshims.dll" and "wer.dll".
    If I may ask, what's wrong with the suggestion I made at the end of the "XP-Issue-posting":

    IMO (regarding "time to invest" on your end), you'd be better off,
    to just move your VB6-stuff over to at least a Win7-installation (or -VM).

    If it's your "personal dev-machine", why not simply upgrade to a newer Win-OS?

    And in case this needs to be deployed to potentially "thousands of hardcore XP-Users" - is that situation really given in your case?
    (do you have information, that there is still a significant percentage of XP-Users among your target-audience)?

    Olaf

  18. #18
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by Schmidt View Post
    If it's your "personal dev-machine", why not simply upgrade to a newer Win-OS?
    Olaf,
    I'm not really a developer. I'm, say, power user. The economist. But sometimes i develop programs as a freelancer. There are a lot of reasons for me to use WinXP:
    1. I know how WinXP works. I have been using it for 16 years.
    2. At least 200 programs are installed on my computer, and some of them do not work under Win10, including, for example, my old Agnitum outpost firewall. I do not know any really good firewall for Windows today.
    3. My next OS is Debian Linux + Wine. Not Win10 or 7. Low system recurements are better for Wine (or maybe ReactOS).
    4. New OS is worth of money. WinXP is still enough for me. If it's interesting for you, I still use MS SQL Server 2000 Developer edition, MS Access 2002 and a lot of other old (but good) stuff in my work.
    5. Do you need more? I still use floppy and MS-DOS. Why? Just for fun But Victoria (official site in Russian and direct link fo latest version with English interface) works better under WinXP, because Win10 API doesn't provide direct access to the ports of the hard disk.
    6. Here I can say a few bad words about Win10, but I will not do it.
    7. And yes, I'm not alone. WinXP have at least 5% of market share (I think - even more, especially in Russia, but they are offline)
    8. I can continue...


    Olaf,
    if you can rebuild the project, please do it. You will help a lot of people 0.831% of programmers uses classic VB. And if 5% of them uses WinXP, and if we have about 20 million developers in the world then 8310 programmers in the world will thank you.

  19. #19
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    573

    Re: PDF Reader ActiveX Control

    Very nice project! Thanks for posting.

  20. #20
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Re: PDF Reader ActiveX Control

    Hi!

    You did a great work with this project ... regrettably, I get a error message when I try to load the sample PDF:

    Error 453
    Cannot find DLL entry point _FPDF_InitLibrary @ 0 in c:\code\PDFReader\pdfium.dll

    I've copied pdfium.dll (Pdfium-x86-no_v8-no_xfa) from https://github.com/pvginkel/PdfiumBu...lds/2018-04-08 into my project folder.
    Size: 3,83 MB (4.016.128 bytes)

    I've tried to register it with 32 bits regsrv32, but it seems it's not registrable.

    I've installed 32 bits Tesseract (but I guess it's not needed if I do not use OCR option)

    Error ocurs on:
    PDFLib = LoadLibraryW(StrPtr(App.Path & "\PDFium.dll"))
    >> FPDF_InitLibrary

    I've also copied pdfium.dll from:

    https://www.nuget.org/packages/Pdfiu....no_v8-no_xfa/

    But no way (I think it's the same)

    I'm working on Windows 10 64 Bits / VB6 SP6.

    Can anyone help me ? I was searching for such a tool several time, and now I'm so near ... and so far .... :-(

    Regards!

    Ronald

  21. #21

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Hello Ronald

    have you tried the dll downloadable by this link? www.ordoconcept.net/pdfium.dll (see Post #9). This is the one I use under Windows 10 64 bits with VB6-SP6 whithout any issue.

    Regards
    François

  22. #22
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Thumbs up Re: PDF Reader ActiveX Control

    Quote Originally Posted by saturnian View Post
    Hello Ronald

    have you tried the dll downloadable by this link? www.ordoconcept.net/pdfium.dll (see Post #9). This is the one I use under Windows 10 64 bits with VB6-SP6 whithout any issue.

    Regards
    François
    Hi François.

    Thank you for your quick answer :-)

    I've just downloaded this dll, it's the same I'm using with you code (same SHA512 Hash).

    As I see with Dependency Walker (https://www.dependencywalker.com/), the entry points seems right, but I get some errors. I'm not sure if they are relevant:
    Error: At least one required implicit or forwarded dependency was not found.
    Error: Modules with different CPU types were found.
    Warning: At least one delay-load dependency module was not found.

    Anyway, I've just installed VB6 on another computer and now it works like a charm. The GetPDFText function is so useful for me .... (automatic invoices accounting).

    You've done a great job !

  23. #23

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by RonaldVG View Post
    Hi François.

    ... Anyway, I've just installed VB6 on another computer and now it works like a charm. The GetPDFText function is so useful for me .... (automatic invoices accounting). ...

    I am pleased,
    although this does not solve the problem on the initial machine?? VB6 Installation issue ??


    Kindly
    François

  24. #24
    Lively Member
    Join Date
    Sep 2016
    Posts
    94

    Re: PDF Reader ActiveX Control

    Hi saturnian

    With the link in your post #21 all works fine.

    Thank you

  25. #25
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by saturnian View Post
    I am pleased,
    although this does not solve the problem on the initial machine?? VB6 Installation issue ??
    Not sure. I've compiled OrdoPDFReader.ocx on the new VB6 machine.

    I'm trying to use it on a third machine (Windows 2008 32 bits) with correct PDFium.dll, using VBA.

    I get same message (Cannot find DLL entry point _FPDF_InitLibrary@0 in PDFium).

    I guess PDFium.dll requires some specific configuration.

    I shall try more configurations to see if I can find the pattern ....

  26. #26
    Member
    Join Date
    Mar 2020
    Posts
    43

    Re: PDF Reader ActiveX Control

    Hi,
    Thanks a lot for your code. My problem is that when printing, it is in low quality. Is there a way to define print quality ?

    La qualité d'impression est comme floue par rapport à une impression avec Acrobat. Comme si on imprimait une image en basse résolution.

  27. #27
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by Crapahute View Post
    Hi,
    Thanks a lot for your code. My problem is that when printing, it is in low quality. Is there a way to define print quality ?
    Maybe you can print directly your PDF file:

    ShellExecute 0&, "Print", "C:\yourfilepath.pdf", "", "", vbNormalFocus

    Regards!

  28. #28
    Member
    Join Date
    Mar 2020
    Posts
    43

    Re: PDF Reader ActiveX Control

    Thanks. I knew this way but I was looking for a solution without using Adobe Reader

    Anyway, thanks again.

  29. #29

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by Crapahute View Post
    Hi,
    Thanks a lot for your code. My problem is that when printing, it is in low quality. Is there a way to define print quality ?

    La qualité d'impression est comme floue par rapport à une impression avec Acrobat. Comme si on imprimait une image en basse résolution.
    Hello Crapahute,
    C'est très sympathique de voir quelques mots en français sur ce forum !

    It's very nice to see a few words in French on this forum!


    The component is a simplified version that prints PDFs in Draft mode.


    To improve print quality:
    In the PDFReader Control add, in the declarations:

    Code:
    Public Enum oPrinterQuality
        [opqDraft] = 72
        [opqLow] = 150
        [opqStandard] = 300
        [opqHigh] = 600
        [opqMax] = 1200
    End Enum
    In the same module, replace the PrintPDF procedure with the following procedure:

    Code:
    Public Sub PrintPDF(Optional Copies As Integer = 1, Optional Orientation As oPrinterOrientation = oAuto, Optional FromPage As Integer = 0, Optional ToPage As Integer = 0, Optional PrinterName As String = "", Optional PrinterQuality As oPrinterQuality = opqStandard)
        Dim X As Printer, Imp_defaut$, F As Integer, i As Integer
        Dim imp_actuelle$
        Dim Page_Height As Double, Page_Width As Double
        Dim row As Integer
        Dim column As Integer, Width As Double, Height As Double, top As Long, left As Long, zoom As Double, columns As Integer, rows As Integer
        Dim vpos As Long, hpos As Long
        Dim margin As Integer, colour As Long, backcolour As String
        Dim HZoom As Double
        
        If NbPage = 0 Then Exit Sub
        'We keep the current printer
        imp_actuelle$ = Printer.DeviceName
         'Check if the right printer exists
        If PrinterName <> imp_actuelle$ And PrinterName > "" Then
            'If yes, change the default printer
            For Each X In Printers
                If X.DeviceName = PrinterName Then
                    Set Printer = X
                    Exit For
                End If
            Next
        End If
        If Copies < 1 Then Copies = 1
        If Copies > 999 Then Copies = 999
        If FromPage < 1 Then FromPage = 1
        If FromPage > NbPage Then FromPage = 1
        If ToPage = 0 Then ToPage = NbPage
        If ToPage > NbPage Then ToPage = NbPage
        If ToPage < FromPage Then ToPage = FromPage
      
        'Printer.Copies
        For i = 1 To Copies
            'Printer initialization
    Start:
            'Here we set the print quality *****************************************************
        Page_Height = PageHeightPoints(0) * ConvertPointToTwips * (PrinterQuality / 72)
            Page_Width = PageWidthPoints(0) * ConvertPointToTwips * (PrinterQuality / 72)
            PictureOCR.Height = Page_Height
            PictureOCR.Width = Page_Width
            If Page_Height - PictureOCR.Height > 2 Or Page_Width - PictureOCR.Width > 2 Then ' we have exceeded the maximum size of a picturebox
                PrinterQuality = PrinterQuality / 2 ' we reduce the quality and start again
                GoTo Start
            End If
            If Orientation = oAuto Then
                If Page_Width <= Page_Height Then Orientation = oPortrait Else Orientation = oLandscape
            End If
            Printer.Orientation = Orientation
            margin = 0 ' 150
            top = Printer.ScaleTop '+ margin
            left = Printer.ScaleLeft '+ margin
            columns = 1 '  to modify if you want to print several pages per sheet
            rows = 1
            Width = (Printer.ScaleWidth + margin) / columns - margin '(margin * 2)
            Height = (Printer.ScaleHeight + margin) / rows - margin '(margin * 2)
            hpos = left + (columns - 1) * (Width + margin)
            vpos = top + (rows - 1) * (Height + margin)
            'check whether width or height is limiting factor
            zoom = Width / Page_Width
            If zoom < Height / Page_Height Then
                ' width limited
                vpos = vpos + (Height - Page_Height * zoom) / 2
                HZoom = Width / Printer.Width
            Else
                ' height limited
                zoom = Height / Page_Height
                hpos = hpos + (Width - Page_Width * zoom) / 2
                HZoom = Height / Printer.Height
            End If
            For F = FromPage To ToPage
                'we draw, store and print the image of the page
                KillFile AddDirSep(KnownFolder(kfUserAppDataLocal)) & "Temp\OrdoPDF.bmp"
                PictureOCR.Cls
                PictureOCR.Picture = Nothing
                Page_Height = PageHeightPoints(F - 1) * ConvertPointToTwips * (PrinterQuality / 72)
                Page_Width = PageWidthPoints(F - 1) * ConvertPointToTwips * (PrinterQuality / 72)
                PictureOCR.Height = Page_Height
                PictureOCR.Width = Page_Width
                DoEvents
                RenderPageToDC PictureOCR.hdc, F - 1, 0, 0, PictureOCR.Width, PictureOCR.Height
                PictureOCR.Picture = PictureOCR.Image
                DoEvents
                ' We print the picture box content
                Printer.PaintPicture PictureOCR.Picture, hpos, vpos, PictureOCR.Width * zoom, PictureOCR.Height * zoom
                Printer.NewPage
            Next F
            Printer.EndDoc
        Next i
        'Possible replacement of the default printer
        If imp_actuelle <> Printer.DeviceName Then
            For Each X In Printers
                If X.DeviceName = imp_actuelle Then
                    Set Printer = X
                    Exit For
                End If
            Next
        End If
    End Sub
    It is then possible to choose the print quality from 72 dpi to 1200 dpi, by entering the optional PrinterQuality variable.

    Best regards

    François
    Last edited by saturnian; Jan 14th, 2022 at 05:50 AM.

  30. #30
    Fanatic Member
    Join Date
    Jan 2015
    Posts
    614

    Re: PDF Reader ActiveX Control

    Vive la Belgique aussi

  31. #31

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by Thierry69 View Post
    Vive la Belgique aussi
    Absolument !

  32. #32
    Member
    Join Date
    Mar 2020
    Posts
    43

    Re: PDF Reader ActiveX Control

    Génial, cela fonctionne, un énorme merci.

    Thank you very much, you rock.

  33. #33
    New Member
    Join Date
    Jul 2019
    Posts
    9

    Re: PDF Reader ActiveX Control

    This is a great project! I modified it a little to draw to an offscreen DC and then bitblt to the picture box. That helps display more complicated PDFs faster.

    In the list of PDFium functions from Olaf's PDF project I saw the FPDF_RenderPage_Start and FPDF_RenderPage_Continue functions which use a callback to progressively draw a page. With more complex PDFs (architectural plans, etc.) an app can appear to hang while drawing so perhaps these functions could provide some indication to the user of the drawing progress.

    Anyone have any ideas implementing this is VB? Thanks!

  34. #34

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by jtw400 View Post
    This is a great project! I modified it a little to draw to an offscreen DC and then bitblt to the picture box. That helps display more complicated PDFs faster....
    Hello jtw400,

    it would be nice to post these changes in this thread, so that the community can test and integrate them.


    Thanks in advance


    Best regards
    François

  35. #35
    New Member
    Join Date
    Jul 2019
    Posts
    9

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by saturnian View Post
    Hello jtw400,

    it would be nice to post these changes in this thread, so that the community can test and integrate them.


    Thanks in advance


    Best regards
    François
    Here you go... use this whenever needed to draw a page from a PDF already opened with "PDFLoad"

    Code:
    Dim TempDC As Long, TempBMP As Long, hDesktop As Long, hBrush As Long, pRect As RECT
    
    hDesktop = GetDesktopWindow()
    
    GetClientRect PDFView.hwnd, pRect
    
    TempDC = CreateCompatibleDC(GetDC(hDesktop))
    TempBMP = CreateCompatibleBitmap(PDFView.hdc, pRect.Right, pRect.Bottom)
       
    SelectObject TempDC, TempBMP
    
    hBrush = CreateSolidBrush(RGB(255, 255, 255))
    FillRect TempDC, pRect, hBrush
    
    RenderPageToDC TempDC, nPage - 1, 0, 0, pRect.Right * Screen.TwipsPerPixelX, pRect.Bottom * Screen.TwipsPerPixelY
    
    BitBlt PDFView.hdc, 0, 0, pRect.Right, pRect.Bottom, TempDC, 0, 0, vbSrcCopy
    
    DeleteDC TempDC
    DeleteObject TempBMP
    DeleteObject hBrush
    
    '///// Declarations
    
    Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
     
    Declare Function GetDesktopWindow Lib "user32" () As Long
    Declare Function GetDC Lib "user32.dll" (ByVal hWnd As Long) As Long
    Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
    Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long
    Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
    Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
    Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
    Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
    Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
    Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long

  36. #36

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Thanks a lot, jtw400

  37. #37
    PowerPoster
    Join Date
    Jan 2020
    Posts
    4,281

    Re: PDF Reader ActiveX Control

    miniblink.dll ,maybe can show pdf ,it's like chrome

  38. #38
    Addicted Member
    Join Date
    Feb 2015
    Posts
    184

    Re: PDF Reader ActiveX Control

    And here we are, some 2+ years later . Thank you for your hard work on this, it works well for me. I'm using the demo program as my default PDF viewer on my personal computer because it is small, fast, and not annoying like Acrobat reader and others. Bravo to you and all of the other contributors .

  39. #39

    Thread Starter
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    93

    Re: PDF Reader ActiveX Control

    Quote Originally Posted by SomeYguy View Post
    And here we are, some 2+ years later . Thank you for your hard work on this, it works well for me. I'm using the demo program as my default PDF viewer on my personal computer because it is small, fast, and not annoying like Acrobat reader and others. Bravo to you and all of the other contributors .
    Glad this code can help you!
    Thanks for this kind message and thanks for thinking of all the contributors!
    Sincerely
    Saturnian

  40. #40
    Lively Member
    Join Date
    Aug 2020
    Location
    Victoria Texas 77904
    Posts
    95

    Re: PDF Reader ActiveX Control

    can't make an executable file out of it. Says the .vbp is not a compatible binary file. Anyone else have this problem ?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width