Print from WebGadget

Just starting out? Need help? Post your questions and find answers here.
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Print from WebGadget

Post by doctorized »

I know it has been asked before about printing from webgadget, but I need to ask again. I have many svgz files that I open them with webgadget. The content is displayed correctly. I want to use "Microsoft print to PDF" printer to make them PDFs. How can it be done?
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: Print from WebGadget

Post by RASHAD »

Hi

Code: Select all

#OLECMDID_PRINT        = 6
#OLECMDID_PRINTPREVIEW = 7
#OLECMDEXECOPT_PROMPTUSER     = 1
#OLECMDEXECOPT_DONTPROMPTUSER = 2

OpenWindow(0, 0,0 , 800, 600, "Print WebGadget", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
  ButtonGadget(0, 10, 10, 100, 30, "Print")
  WebGadget(1, 10, 50, 780, 540, "http://www.purebasic.com")
  WebObject.IWebBrowser2
  WebObject = GetWindowLongPtr_(GadgetID(1), #GWL_USERDATA)
Repeat
  Select WaitWindowEvent()
     Case #PB_Event_CloseWindow
        Quit =1
        
     Case #PB_Event_Gadget
        Select EventGadget()
           Case 0
              WebObject\ExecWB(#OLECMDID_PRINT, #OLECMDEXECOPT_PROMPTUSER, 0, 0)
              ; WebObject\ExecWB(#OLECMDID_PRINT, #OLECMDEXECOPT_DONTPROMPTUSER, 0, 0) ; No PrintRequester
        EndSelect     
  EndSelect
Until Quit = 1
Egypt my love
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: Print from WebGadget

Post by doctorized »

RASHAD wrote:Hi

Code: Select all

              ; WebObject\ExecWB(#OLECMDID_PRINT, #OLECMDEXECOPT_DONTPROMPTUSER, 0, 0) ; No PrintRequester
As I want to use pdf printer, is there a way to pass the file name to the printer? It opens a windows requesting file name to create, even if I use the second line for no PrintRequester.
User avatar
doctorized
Addict
Addict
Posts: 856
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: Print from WebGadget

Post by doctorized »

I changed some settings to Adobe PDF printer and now I can save the files to pdf without any dialogs. The only problem that I have, is the page number added at the top of the page as header and the file name at the bottom of the page. I did a small search and, according to Adobe here, this addition is done by my app. Solution?
Post Reply