Page 1 of 1

Using PurePDF from within a module?

Posted: Fri Sep 25, 2015 4:34 pm
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!

Re: Using PurePDF from within a module?

Posted: Fri Sep 25, 2015 4:56 pm
by infratec
Hi,

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


Bernd

Re: Using PurePDF from within a module?

Posted: Fri Sep 25, 2015 5:02 pm
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
  ...

Re: Using PurePDF from within a module?

Posted: Fri Sep 25, 2015 5:09 pm
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

Re: Using PurePDF from within a module?

Posted: Fri Sep 25, 2015 6:01 pm
by kpeters58
Thank you, Bernd, for going the extra mile - much appreciated

Re: Using PurePDF from within a module?

Posted: Sat Mar 26, 2016 10:18 am
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 ?

Re: Using PurePDF from within a module?

Posted: Sat Mar 26, 2016 3:28 pm
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