Just starting out? Need help? Post your questions and find answers here.
Stefan
 
Posts: 63
Joined: Mon Feb 05, 2018 9:44 pm

Reading / open an PDF file

by Stefan Wed Jun 26, 2019 3:48 pm

How can I read / open an PDF file in Spiderbasic?
I tried this:

Code: Select all


Procedure ReadCallback(Status, Filename$, File, Size)
  If Status = #PB_Status_Loaded
    Debug Filename$
    Debug file
   
    ! window.open('V_Filename', '_blank');
    ;! window.open(v_filename, '_blank');
   
  ElseIf Status = #PB_Status_Error
    Debug "Error when loading the file: " + Filename$
  EndIf
EndProcedure

Procedure OpenFileRequesterCallback()
  If NextSelectedFile()
    ReadFile(0, SelectedFileID(), @ReadCallback(), #PB_LocalFile)
  EndIf
EndProcedure

Procedure ChooseFileEvent()
  OpenFileRequester("text/plain", @OpenFileRequesterCallback())
EndProcedure

ExamineDesktops()


OpenWindow(0, 0, 0, DesktopWidth(0), DesktopHeight(0), "Read file example", #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 280, 30, "Choose a text file...")

BindGadgetEvent(0, @ChooseFileEvent())





But it doesn't work.
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 5 guests