PDF from XML/XSL

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
kenbla
User
Posts: 40
Joined: Wed Jun 21, 2006 1:29 pm

PDF from XML/XSL

Post by kenbla »

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!
Regards,
Kenbla
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF from XML/XSL

Post by Tracker Supp-Stefan »

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
kenbla
User
Posts: 40
Joined: Wed Jun 21, 2006 1:29 pm

Re: PDF from XML/XSL

Post by kenbla »

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!
Regards,
Kenbla
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: PDF from XML/XSL

Post by John - Tracker Supp »

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
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
kenbla
User
Posts: 40
Joined: Wed Jun 21, 2006 1:29 pm

Re: PDF from XML/XSL

Post by kenbla »

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
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF from XML/XSL

Post by Tracker Supp-Stefan »

Glad to hear that kenbla,

Cheers,
Stefan
kenbla
User
Posts: 40
Joined: Wed Jun 21, 2006 1:29 pm

Re: PDF from XML/XSL

Post by kenbla »

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?
Regards,
Kenbla
kenbla
User
Posts: 40
Joined: Wed Jun 21, 2006 1:29 pm

Re: PDF from XML/XSL

Post by kenbla »

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?
Regards,
Kenbla
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: PDF from XML/XSL

Post by Ivan - Tracker Software »

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)
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.
kenbla
User
Posts: 40
Joined: Wed Jun 21, 2006 1:29 pm

Re: PDF from XML/XSL

Post by kenbla »

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
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: PDF from XML/XSL

Post by Ivan - Tracker Software »

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