Using PurePDF from within a module?

Just starting out? Need help? Post your questions and find answers here.
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

Using PurePDF from within a module?

Post by kpeters58 »

I just went with the PurePDF source instead of the library and after being very happy exploring PurePDF's capabilities via the plentyful and well documented examples, now the next stumper:

[08:26:06] [COMPILER] Line 568: ProcedureDLL and ProcedureCDLL can't be used inside a module.

Is there any way around this (aside form de-modularizing my application, which is not an option)?

As always, any help is much appreciated!
PB 5.73 on Windows 10 & OS X High Sierra
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Using PurePDF from within a module?

Post by infratec »

Hi,

have you included the pb file and set the constant #PurePDF_Include to #True?


Bernd
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

Re: Using PurePDF from within a module?

Post by kpeters58 »

Yes, see the top of the relevant module below (if I hadn't, I would not see that error):

Code: Select all

Module IntakeReport
  
  ; TODO static warning re. unencrypted data in generated PDFs etc.
  ; TODO add open button?
  
  UseModule Definitions
  
  #PurePDF_Include=1
  XIncludeFile "PurePDF.pb"
  
  Global Statusbar, Frame_Search, String_ID, String_Last, String_First, ListIcon_Selection
  ...
PB 5.73 on Windows 10 & OS X High Sierra
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Using PurePDF from within a module?

Post by infratec »

Ok,

after try it by myself I see it.

The 'dirty' solution:

Place at top of PurePDF.pb

Code: Select all

CompilerIf Defined(PurePDF_Include,#PB_Constant)
  Macro ProcedureMacro
    Procedure
  EndMacro
CompilerElse
  Macro ProcedureMacro
    ProcedureDLL
  EndMacro
CompilerEndIf
And replace all ProcedureDLL with ProcedureMacro.
But not that one from above :wink:

Then this work:

Code: Select all

Module Ferrari
    
    #PurePDF_Include=1
    XIncludeFile "PurePDF.pb"
    
    Global Initialized = #False
    
    Procedure Init() ; Private init procedure
      If Initialized = #False
        Initialized = #True
        Debug "InitFerrari()"
      EndIf
    EndProcedure  
      
    Procedure CreateFerrari()
      Init()
      Debug "CreateFerrari()"
      pdf_Create()
    EndProcedure
    
  EndModule
And the original stuff is working too.

Bernd
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

Re: Using PurePDF from within a module?

Post by kpeters58 »

Thank you, Bernd, for going the extra mile - much appreciated
PB 5.73 on Windows 10 & OS X High Sierra
loulou2522
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Oct 14, 2014 12:09 pm

Re: Using PurePDF from within a module?

Post by loulou2522 »

I make all you write on the topics but some function not work like PDF_GETY() 'the system respond me that's not a valid function)
Has someone an idea ?
loulou2522
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Oct 14, 2014 12:09 pm

Re: Using PurePDF from within a module?

Post by loulou2522 »

I find the solution by myself.
In fact at level
LIne 57 to 59 of Pure_Pdf.pb

Code: Select all

CompilerIf Defined(PurePDF_Include,#PB_Constant)
  XIncludeFile "PurePDF_res.pb"
CompilerEndIf
You have to modify by
CompilerIf Defined(PurePDF_Include,#PB_Constant)
IncludeFile "PurePDF_res.pb"
CompilerEndIf
Because if you don't modify that PurePDF_res.pb is include only on the first module and not on the second
After Pure_Pdf works well on X64 without problems
Post Reply