PDF from XML/XSL
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
PDF from XML/XSL
Hello, I work in a Delphi environment and I want to find out what the best way is to create a PDF file in the following case:
- I have an XML file
- I have an XSL file which is use/can use to convert the XML file to an HTML report
- I want to create a PDF file from the HTML report and store it to disk
Thanks!
- I have an XML file
- I have an XSL file which is use/can use to convert the XML file to an HTML report
- I want to create a PDF file from the HTML report and store it to disk
Thanks!
Regards,
Kenbla
Kenbla
- Tracker Supp-Stefan
- Site Admin
- Posts: 17945
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: PDF from XML/XSL
Hello Kenbla,
You've posted in our OCR forums, so I will move your topic in a more appropriate place when you see this reply.
I believe it would be easiest for you to utilize our printing drivers:
https://www.pdf-xchange.com/product ... rivers-api
And you will only need to "print" either the XML of HTML file to it, and can then control the print job fully via code.
Regards,
Stefan
You've posted in our OCR forums, so I will move your topic in a more appropriate place when you see this reply.
I believe it would be easiest for you to utilize our printing drivers:
https://www.pdf-xchange.com/product ... rivers-api
And you will only need to "print" either the XML of HTML file to it, and can then control the print job fully via code.
Regards,
Stefan
Re: PDF from XML/XSL
I have made some progress in this matter but I'm not quite there yet!
I have copied some code from the examples that came with PDFXChange like this:
"if (bwrPrint.ReadyState = READYSTATE_COMPLETE then)"
Normally bwrPrintReadyState should be equal to READYSTATE_COMPLETE but in my case it is equal to READYSTATE_LOADING (value 1) which means that the PDF conversion doesn't take place!
Can anyone explain to me what I might have done wrong?
Have a good weekend!
I have copied some code from the examples that came with PDFXChange like this:
"if (bwrPrint.ReadyState = READYSTATE_COMPLETE then)"
Normally bwrPrintReadyState should be equal to READYSTATE_COMPLETE but in my case it is equal to READYSTATE_LOADING (value 1) which means that the PDF conversion doesn't take place!
Can anyone explain to me what I might have done wrong?
Have a good weekend!
Regards,
Kenbla
Kenbla
- John - Tracker Supp
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
- Contact:
Re: PDF from XML/XSL
Can you please provide some Pseudo code as to the process you are using to do the conversion and if you are interacting with any 3rd party tools or app's - etc - what they are and we will try to help.
Thanks
Thanks
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
Re: PDF from XML/XSL
Thanks John, I have now solved the problem and it works fine! I don't know what the problem was, all of a sudden it simply worked!
Regards,
Kenbla
Kenbla
- Tracker Supp-Stefan
- Site Admin
- Posts: 17945
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: PDF from XML/XSL
Glad to hear that kenbla,
Cheers,
Stefan
Cheers,
Stefan
Re: PDF from XML/XSL
Hello again, I don't know to say this but the PDF creation in my Delphi program works at times but not always!! It worked fine from friday afternoon until this morning (tuesday) but when I ran the application this morning the PDF file did not get created! I have not made any changes to the application that has anything to do with the PDF creation!
Is PDFXChange unstable or what can the problem be?
Is PDFXChange unstable or what can the problem be?
Regards,
Kenbla
Kenbla
Re: PDF from XML/XSL
When it doesn't work the bwrPrint.ReadyState in my code example below is = 1 (is loading) and therefore the code including bwrPrint.ExecWB is not run! I have tried a number of things like put the application to sleep for a few seconds but it didn't help. One odd thing that has made the application work is to add a ShowMessage to the code (bwrPrint.ReadyState is then set to 4 for some reason)! But that is not a very good solution!
My code:
if bwrPrint.ReadyState = READYSTATE_COMPLETE then
begin
bwrPrint.Navigate(msExportPath + '\' + VAL_TEXT + msExcelFile + msBlobStreamFormat);
vaIn := OleVariant(VarAsType(PRINT_WAITFORCOMPLETION, varSmallint));
bwrPrint.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, vaIn, vaOut);
end;
Any explanation to my problem?
My code:
if bwrPrint.ReadyState = READYSTATE_COMPLETE then
begin
bwrPrint.Navigate(msExportPath + '\' + VAL_TEXT + msExcelFile + msBlobStreamFormat);
vaIn := OleVariant(VarAsType(PRINT_WAITFORCOMPLETION, varSmallint));
bwrPrint.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, vaIn, vaOut);
end;
Any explanation to my problem?
Regards,
Kenbla
Kenbla
- Ivan - Tracker Software
- Site Admin
- Posts: 3550
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: PDF from XML/XSL
I suspect you have to call bwrPrint.Navigate, then wait until bwrPrint.ReadyState become READYSTATE_COMPLETE.
Please check documentation about IWebBrowser interface (http://msdn.microsoft.com/en-us/library ... s.85).aspx)
Please check documentation about IWebBrowser interface (http://msdn.microsoft.com/en-us/library ... s.85).aspx)
Tracker Software (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Re: PDF from XML/XSL
Thanks for your reply. I have already performed a bwrPrint.Navigate (doesn't show in the piece of code I provided) and I have also tried to put my application to sleep for 10 seconds after the first bwrPrint.Navigate so that doesn't seem to be the problem in my case. And also the fact that it works sometimes but not always is a bit scary!
Regards,
Kenbla
Kenbla
- Ivan - Tracker Software
- Site Admin
- Posts: 3550
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: PDF from XML/XSL
We have no control over IWebBrowser component - it is IE's part.
Tracker Software (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.