COM output from HTML to file

The following code works well for me.  I'm auto-saving information at numerous times.  I'm viewing some very large graphs to save as a BMP and that way it's faster to display to the users as a BMP instead of a 15,000 datapoint graph.

The problem... Internet explorer. This is the program that is launched when saving the information.  I've changed PC defaults and no joy having PDFcreator open this with a different browser, like firefox.  

Can this be acomplished? 

Should I try and use a different method of saving a flash embedded .aspx file to an image (doesn't matter what type)?

I'm using PDFCreator 1.4.1. Visual studio 2010. running on Server 2008 R2.

 

 

        Dim fname As String, DefaultPrinter As String
        Dim opt As PDFCreator.clsPDFCreatorOptions

        opt = _PDFCreator.cOptions
        With opt
            .UseAutosave = 1
            .UseAutosaveDirectory = 1
            .AutosaveDirectory = "c:\\dummy\\"
            .AutosaveFormat = 3
            '0 is pdf
            '1 PNG
            '2 jpg
            '3 BMP
            '5 is tiff
            opt.AutosaveFilename = "me.bmp"
        End With

        Dim sURL As String = "http://www.pdfforge.com"
        With _PDFCreator
            .cOptions = opt
            .cClearCache()
            Application.DoEvents()
            DefaultPrinter = .cDefaultPrinter
            .cDefaultPrinter = "PDFCreator"
            .cPrintURL(sURL, 9000)
            ReadyState = False
            .cPrinterStop = False
        End With

        Timer1 = New Timer
        With Timer1
            .Interval = CDbl(120) * 1000
            .Enabled = True
            Do While Not ReadyState And .Enabled
                Application.DoEvents()
            Loop
            Application.DoEvents()
            .Enabled = False
            Application.DoEvents()
            .Dispose()
        End With

        _PDFCreator.cPrinterStop = True
        _PDFCreator.cDefaultPrinter = DefaultPrinter
        _PDFCreator.cClearCache()
        _PDFCreator.cClose()

        opt = Nothing

Hi,

you would need to open the file in Firefox first and print it from there afterwards.

regards,

Robin

Hi,

 

sorry but I am not sure if  I got the question correctly, is it how to get rid of IE opening?

 

regards,

 

Robin

Internet explorer seems to be the default method to load a webpage and convert it.  The issue is that Internet explorer is not viewing it properly, too much data and it does not like it. 

Not getting rid of IE, I'm trying to get the method to use a different browser by default.

 

Either this or is there a different way to achieve this other than what I'm currently doing?

Hi,

 

have you set Firefox to be the default browser? If that isn´t enough, right click on the file you want to convert and choose "open with" then choose your preferred browser and make sure the checkbox "always open filetype with the chosen application" (or similar, I´m on german Windows atm) is checked.

 

regards,

 

Robin

yes firefox is the default browser.  for both HTML, HTM, ASPX, etc.  you create a shortcut, double click and it opens in firefox.

 

My question, is the code for some reason hard coded to open it inside internet explorer?  

 

The sample code I provided will replicate this issue.

Hi,

 

using another method is probably the best option. The cPrintURL calls the shell print command, maybe it is possible to change the behaviour of the shell print command by editing the registry, but it is probably more work then using a different method to do it.

 

regards,

 

Robin

I searched through the registry items and couldn't find any reference to the default program it is using...

[HKEY_CLASSES_ROOT\\pdfforge Images2PDF\\shell\\open\\command]
@="\\"C:\\\\Program Files (x86)\\\\PDFCreator\\\\Images2PDF.EXE\\" \\"%1\\""

 

I also searched for iexplore and exe within the contents of all files under C:\\\\Program Files (x86)\\\\PDFCreator\\ and could not find anything.

 

Can you point me in the direction of a different method of capturing a webpage, and saving it as a BMP/JPG/etc?  Or a PDF and cropping that into a BMP/JPG I guess?

I don’t believe you understand.  I need to automate this from an executable and internet explorer does not work.

Can you give me sample code how I would automate the opening of firefox, viewing the page, print as image and close it?

Hi,

I do understand the problem, but basicly it´s not a PDFCreator issue, but a MS/general scripting one and I would need to research that code aswell:)

regards,

Robin

Thank you. Please let me know what you find.

As I specified above ideas on how to find links as to what method of web browser is being used to launch the page, I could not find where to change it.  This is in my opinion the easiest way of fixing this entire problem if you could manually launch a different browser.

Hi,

it looks like there is no proper command-line for printing from firefox,
maybe this tool will help, I havn´t tested it though.
https://sites.google.com/site/torisugari/commandlineprint2

regards,

Robin

Hi,

i have managed to find a way to print .htmls without opening any browser, by changing the value of HKEY_CLASSES_ROOT\htmlfile\shell\Print\command to: rundll32.exe %windir%\system32\mshtml.dll,PrintHTML “%1” “%2” “%3” "%4"

I did this in a VM, always be carefull with editing registry settings.

regards,

Robin

Is there now a solution to this problem?
Or you still need to edit the regestry?
An offline HTML to PDF convertion would be a very good feature.

Robin,

That registry key was already setup this way, this is a server 2008 r2 without office installed. If you watch processes when you execute it, the process “iexplore.exe” comes up and goes away when completed. This is what I’m trying to avoid, the hidden iexplore.exe.

StigyBit.  I have not found a solution to this problem. 

One possiblility I found is CutyCapt. 

Any thoughts?