Author Topic: Print preview doesn´t work anymore  (Read 5582 times)

0 Members and 1 Guest are viewing this topic.

Offline Juergen Kuehlwein

  • Full Member
  • ***
  • Posts: 129
  • User-Rate: +0/-0
Print preview doesn´t work anymore
« on: August 06, 2014, 03:13:57 PM »
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)
Code: [Select]
  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.


Thanks

JK

Offline Juergen Kuehlwein

  • Full Member
  • ***
  • Posts: 129
  • User-Rate: +0/-0
Re: Print preview doesn´t work anymore
« Reply #1 on: August 06, 2014, 04:40:46 PM »
Jose,

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...


JK

Offline Juergen Kuehlwein

  • Full Member
  • ***
  • Posts: 129
  • User-Rate: +0/-0
Re: Print preview doesn´t work anymore
« Reply #2 on: August 06, 2014, 06:52:03 PM »
Now i tried a workaround: save html data to a temporary file and use "pIWebBrowser2.Navigate2" like this:


Code: [Select]

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

  pIWebBrowser2.Navigate2(vVar)


this is what i get:


Quote
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'. "



JK

Offline Juergen Kuehlwein

  • Full Member
  • ***
  • Posts: 129
  • User-Rate: +0/-0
Re: Print preview doesn´t work anymore
« Reply #3 on: August 06, 2014, 07:01:30 PM »
Jose,


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.


Thanks


JK

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2481
  • User-Rate: +204/-0
Re: Print preview doesn´t work anymore
« Reply #4 on: August 07, 2014, 07:38:00 AM »
Are you calling the print/preview dialog from a thread?

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 919
  • User-Rate: +30/-4
    • it-berater
Re: Print preview doesn´t work anymore
« Reply #5 on: August 08, 2014, 03:18:48 PM »
Look here:
http://www.jose.it-berater.org/smfforum/index.php?topic=4671.0
I have added a afxDoEvents to solve it.

Offline Juergen Kuehlwein

  • Full Member
  • ***
  • Posts: 129
  • User-Rate: +0/-0
Re: Print preview doesn´t work anymore
« Reply #6 on: August 19, 2014, 11:39:29 PM »
Back from a few days of hollyday...


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


Thanks,


JK