|
-
Apr 20th, 2025, 11:54 AM
#81
Thread Starter
Addicted Member
Re: PDF Reader ActiveX Control
 Originally Posted by DTZlevelei
Thank you for your response! In the sketch above, I was brainstorming how the UI could be made more clear and less "noisy". I mentioned the grey also, and only as a detail, because if the lines and the less important labels are lighter than black, it helps draw attention more effectively to the truly important texts. But it is up to you of course.
.
And the other question: Would it be possible to make the print dialog (opened via PrintPDFWithDialog or PrintPDFWithDialogEx) default to a specific printer that's set from my code?
Yes, it's possible.
The print dialog box displays the Windows default printer by default.
Simply set the default printer to the one you want, then call the print function, and then reset the Windows default printer upon returning.
Code:
Dim WindowsPrinter as String
Dim MyChoiceOfPrinter as String
Dim X as Printer
WindowsPrinter = Printer.DeviceName
MyChoiceOfPrinter = "WhatEverYouWant"
If MyChoiceOfPrinter <> WindowsPrinter And MyChoiceOfPrinter > "" Then
'Change the Windows Default Printer
For Each X In Printers
If X.DeviceName = MyChoiceOfPrinter Then
Set Printer = X
Exit For
End If
Next
End If
' Call the print function.
PrintPDFWithDialogEx
If WindowsPrinter <> Printer.DeviceName Then
' Reset the windows default printer
For Each X In Printers
If X.DeviceName = WindowsPrinter Then
Set Printer = X
Exit For
End If
Next
End If
-
Apr 20th, 2025, 04:13 PM
#82
New Member
Re: PDF Reader ActiveX Control
I'm sorry, but no. The default printer is set correctly, but on the PrintPDFWithDialogEx panel, the last (!) item in the printer list appears as the selected one when the panel opens. I am using Windows11.
-
Apr 21st, 2025, 01:44 AM
#83
Thread Starter
Addicted Member
Re: PDF Reader ActiveX Control
 Originally Posted by DTZlevelei
I'm sorry, but no. The default printer is set correctly, but on the PrintPDFWithDialogEx panel, the last (!) item in the printer list appears as the selected one when the panel opens. I am using Windows11.
I'll check this on different versions of Windows.
Thanks for the feedback.
-
Apr 21st, 2025, 04:51 AM
#84
Thread Starter
Addicted Member
Re: PDF Reader ActiveX Control
 Originally Posted by DTZlevelei
I'm sorry, but no. The default printer is set correctly, but on the PrintPDFWithDialogEx panel, the last (!) item in the printer list appears as the selected one when the panel opens. I am using Windows11.
I tested on Windows7, 10 and 11 and I could not recreate the bug???
Can you try changing the default printer by choosing "Microsoft Print to PDF" for example, to see if the issue is not related to the name of your default printer?
-
Apr 22nd, 2025, 12:52 AM
#85
Lively Member
Re: PDF Reader ActiveX Control
Last edited by Crapahute; Apr 22nd, 2025 at 12:59 AM.
-
Apr 22nd, 2025, 03:20 AM
#86
Thread Starter
Addicted Member
Re: PDF Reader ActiveX Control
 Originally Posted by Crapahute
When running the example program (compiled, under W11), I can easily resize the form until I load a PDF.
Ahh, I understand better with these images!
I apologize.
It's indeed a bug on my part!
To fix this issue, replace all occurrences of Screen.Mousepointer = vbArrow with Screen.Mousepointer=vbDefault in the PDFReader project.
François
-
Apr 22nd, 2025, 06:38 AM
#87
Lively Member
Re: PDF Reader ActiveX Control
 Originally Posted by saturnian
Ahh, I understand better with these images!
I apologize.
It's indeed a bug on my part!
To fix this issue, replace all occurrences of Screen.Mousepointer = vbArrow with Screen.Mousepointer=vbDefault in the PDFReader project.
François
Ah merci, je n'y avais pas pensé !
-
Apr 22nd, 2025, 06:40 AM
#88
Thread Starter
Addicted Member
Re: PDF Reader ActiveX Control
 Originally Posted by Crapahute
Ah merci, je n'y avais pas pensé !
-
May 2nd, 2025, 02:57 AM
#89
Addicted Member
Re: PDF Reader ActiveX Control
 Originally Posted by saturnian
Hi zx81sp,
The SaveAs function code is easy to deduce from previous posts in this thread.
A pinch of Calcu, a dash of Fafalone, and voila! It's ready.
To simplify your life, I've added my SaveAs function code from the OrdoPDFReader OCX in this new version : Attachment 194600
Best regards,
François
Hi
I assume that version needs the new PDFIUM.DLL (I was using the old one with the original control). I've downloaded the new PDFIUM.DLL version, replace the old one, load the new control (bb2) but if fails when I try to load a PDF (PDFReader1.load "c:\pdf.pdf"):
Can't find entrypoint _FPDF_LoadMemDocument@12 en PDFium
What I'm doing wrong? I'm using your control in a compiled OCX, not in source code.
Edit: I had a wrong ocx version (new pdfium.dll with old ocx), I've recompiled but still an error when I try to load the PDF (invalid argument). If I put an "on error goto next" the PDF is been loaded right in the control 
Edit2: the problem is that I try to load the PDF in the form_load event, if I load it after the form is displayed all works fine (old version worked ok loading the PDF in the form_load event)
Last edited by zx81sp; May 2nd, 2025 at 03:14 AM.
-
May 2nd, 2025, 03:38 AM
#90
Addicted Member
Re: PDF Reader ActiveX Control
Hi @saturnian
I've added a new function, extract text for a selected page:
Code:
Public Function GetPDFTextPag(f As Long) As String
tmpText As String, CharsCount As Long, resultText As String
If NbPage > 0 Then
mPageText = FPDFText_LoadPage(Pages(f))
CharsCount = FPDFText_CountChars(mPageText)
tmpText = Space$(CharsCount)
If Len(tmpText) Then FPDFText_GetText mPageText, 0, Len(tmpText) + 1, StrPtr(tmpText)
resultText = resultText & tmpText & vbCrLf
FPDFText_ClosePage mPageText
End If
GetPDFTextPag = resultText
End Function
It could be done in the original GetPDFText with an optional argument but it would break my binary compatibility so I write a new sub for this, may be it would be useful for someone else.
Thks
Last edited by zx81sp; May 2nd, 2025 at 04:04 AM.
-
May 12th, 2025, 10:01 PM
#91
Re: PDF Reader ActiveX Control
can make a pdfdll_api.bas,and make to *.objfile,so we no need user cdecl fixed
Code:
Private Declare Sub FPDF_InitLibrary Lib "PDFium" Alias "_FPDF_InitLibrary@0" ()
Private Declare Sub FPDF_DestroyLibary Lib "PDFium" Alias "_FPDF_DestroyLibrary@0" ()
Private Declare Function FPDF_LoadMemDocument Lib "PDFium" Alias "_FPDF_LoadMemDocument@12" (ByVal pData As Long, ByVal DataLen As Long, ByVal Password As String) As Long
Private Declare Sub FPDF_CloseDocument Lib "PDFium" Alias "_FPDF_CloseDocument@4" (ByVal hDoc As Long)
Private Declare Function FPDF_GetPageCount Lib "PDFium" Alias "_FPDF_GetPageCount@4" (ByVal hDoc As Long) As Long
WHY AI NAME NOT SAME?
_FPDF_DestroyLibrary??
FORM_CanRedo
FORM_CanUndo
FORM_DoDocumentAAction
FORM_DoDocumentJSAction
FORM_DoDocumentOpenAction
FORM_DoPageAAction
FORM_ForceToKillFocus
FORM_GetFocusedAnnot
FORM_GetFocusedText
FORM_GetSelectedText
FORM_IsIndexSelected
Last edited by xiaoyao; May 12th, 2025 at 10:06 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|