Hi,
our application generates documents on your printer using Win32 API (CreateDC, StartDoc, PlayMetafile etc.). It works fine (apart from some issues on Win7, but it's not the point here).
We need PDFs to be saved automatically under specific names in particular destination folders.
So far I implemented it in the following way:
when OnDocSpooled event comes, I set "Save.File" and "Save.Path" options (+ some others), call ApplyOptions
when OnFileSaved comes, I clear the profile with ResetDefaults + ApplyOptions.
The thing is, I profiled the app and noticed, that "ApplyOptions" is totally inefficient (more time is spent on executing the function than on a printing a short document itself), so I searched for another approach.
According to your documentation, one can make a use of DOCINFO.lpszDocName string (passed to StartDoc function). I've tried possibly all permutations of macros/options, but been only partially successful. I cannot make the PDF printer save the document in a specific folder. The only thing I could achieve was at least giving a document a specific name when using Save.File= %[DocName],StripPath = yes, but Save.Path=%[DocPath] seems not to be evaluated and the doc is being stored in "My Documents" path.
My question is: what macros should I assign to the options
Save.File
Save.Path
Save.StripPath
in order for a PDF file to be saved at location passed via DOCINFO.lpszDocName ?
Regards,
Maciej
%[DocName] %[DocPath] macros not working?
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
-
- User
- Posts: 23
- Joined: Mon Feb 09, 2009 8:52 am
-
- User
- Posts: 23
- Joined: Mon Feb 09, 2009 8:52 am
Re: %[DocName] %[DocPath] macros not working?
Any ideas?
I noticed a following topic here at the forum: https://forum.pdf-xchange.com/ ... ath#p28276 .
Ivan writes: "...%[DocPath] can be empty, because not all applications provide path as a part of printed document". I do not understand it: I'm writing my application though, so I should be able to provide the path. So my question is still: HOW? How do I make %[DocPath] work at all?
Regards,
Maciej
I noticed a following topic here at the forum: https://forum.pdf-xchange.com/ ... ath#p28276 .
Ivan writes: "...%[DocPath] can be empty, because not all applications provide path as a part of printed document". I do not understand it: I'm writing my application though, so I should be able to provide the path. So my question is still: HOW? How do I make %[DocPath] work at all?
Regards,
Maciej
- Tracker Supp-Stefan
- Site Admin
- Posts: 17910
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: %[DocName] %[DocPath] macros not working?
Hello Maciej,
Seems like we will need Ivan to have a look at this topic as well, and as he is in the Canadian office it will probably take a couple more hours, but I will try to get you an answer today.
Best,
Stefan
Seems like we will need Ivan to have a look at this topic as well, and as he is in the Canadian office it will probably take a couple more hours, but I will try to get you an answer today.
Best,
Stefan
- Ivan - Tracker Software
- Site Admin
- Posts: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: %[DocName] %[DocPath] macros not working?
ApplyOptions is not necessary if you print from your own application and doesn't use the Printer preferences dialog after setting options.
Call to ApplyOptions takes some time (sometimes a lot of) because it stores settings in the registry and default DEVMODE, and sends notification about this to all open applications.
To save file as you want, you need to set
Save.File == full path where you want to store your PDF file
Save.Path and Save.StripPath in this case can be omitted
Call to ApplyOptions takes some time (sometimes a lot of) because it stores settings in the registry and default DEVMODE, and sends notification about this to all open applications.
To save file as you want, you need to set
Save.File == full path where you want to store your PDF file
Save.Path and Save.StripPath in this case can be omitted
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.
-
- User
- Posts: 23
- Joined: Mon Feb 09, 2009 8:52 am
Re: %[DocName] %[DocPath] macros not working?
Hi Ivan,
thanks a lot! This is something I couldn't read out of the docs and examples. I was pretty sure ApplyOptions must be used always when any option changes, to really be utilized by the printer.
I will give it a try and drop a line here whether it works.
Regards!
Maciej
thanks a lot! This is something I couldn't read out of the docs and examples. I was pretty sure ApplyOptions must be used always when any option changes, to really be utilized by the printer.
I will give it a try and drop a line here whether it works.
Regards!
Maciej
- Tracker Supp-Stefan
- Site Admin
- Posts: 17910
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: %[DocName] %[DocPath] macros not working?
We will be waiting for those comments Maciej
Best,
Stefan
Best,
Stefan
-
- User
- Posts: 23
- Joined: Mon Feb 09, 2009 8:52 am
Re: %[DocName] %[DocPath] macros not working?
Hi,
it works fine, thank you for the hint! It made our reporting much much faster!
I believe this kind of information should be included in your documentation too. Just by looking at your examples and the docs, I was convinced ApplyOptions is a MUST, whenever one sets printer's properties.
Regards,
Maciej
it works fine, thank you for the hint! It made our reporting much much faster!
I believe this kind of information should be included in your documentation too. Just by looking at your examples and the docs, I was convinced ApplyOptions is a MUST, whenever one sets printer's properties.
Regards,
Maciej
- Tracker Supp-Stefan
- Site Admin
- Posts: 17910
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: %[DocName] %[DocPath] macros not working?
Hi Maciej,
I will make a note to the guys responsible for the manuals to have this included in the next revision.
Best,
Stefan
I will make a note to the guys responsible for the manuals to have this included in the next revision.
Best,
Stefan