• Welcome to PowerBasic Museum 2020-A.


Forum in repository mode. No new members allowed.

Main Menu

Print preview doesn´t work anymore

Started by Juergen Kuehlwein, August 06, 2014, 03:13:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Juergen Kuehlwein

Hi Jose,

i added and changed a lot in CSED to meet my specific needs, but left CSED_princ.inc untouched so far. Print Preview isn´t working anymore now. In your original version it does work! So what could i have crashed elsewhere in order to make print preview not work anymore.

As far as i can tell the problem seems to be this line: (CSED_Print.inc)

  IHTMLDocument2_WriteString(pHTMLDocument2, strText)

"strtext" holds the expected data (this i can verify - the created html code shows without error in e.g. firefox), but it doesn´t show up in preview (print preview window shows up, but without code content).

I changed the main message pump (in CSED.bas - Winmain), could this be a problem ? I guess - No,  print preview uses it´s own ("pPrint.DoEvents") - right ?

There must be something else i changed and didn´t notice it´s dependency for print preview.

Maybe you could give me a hint which are the requirements for print preview to work.



Juergen Kuehlwein


just replaced my file with your original file (CSED_Print.inc) - compiles, runs but doesn´t work either, I´m somewhat out of ideas, what could be wrong... (must be somewhere else).

Any help woulde be appreciated...


Juergen Kuehlwein

Now i tried a workaround: save html data to a temporary file and use "pIWebBrowser2.Navigate2" like this:

  strUrl = "file:///" + EXE.PATH$ + "print.dat"
  vVar = strUrl


this is what i get:

Die XML-Seite kann nicht angezeigt werden
Die XML-Eingabe kann nicht angezeigt werden, wenn Stylesheet verwendet wird. Beheben Sie den Fehler und klicken Sie dann auf Aktualisieren oder wiederholen Sie den Vorgang später.


Unbekannter Fehler Fehler beim Bearbeiten der Ressource 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd';.

meaning in short:
"This xml site cannot be shown - unknown error when processing 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd';. "


Juergen Kuehlwein


changing the file name from "print.dat" to print.htm" makes it work now like a charm (the workaround code). I still would like to know, why "IHTMLDocument2_WriteString(pHTMLDocument2, strText)" doesn´t work for me.



José Roca

Are you calling the print/preview dialog from a thread?

Theo Gottwald

Juergen Kuehlwein

Back from a few days of hollyday...

Theo, Indeed this solves the whole issue for me as well!