%[DocName] %[DocPath] macros not working?

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
Maciej Tokarski
User
Posts: 23
Joined: Mon Feb 09, 2009 8:52 am

%[DocName] %[DocPath] macros not working?

Post by Maciej Tokarski »

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
Maciej Tokarski
User
Posts: 23
Joined: Mon Feb 09, 2009 8:52 am

Re: %[DocName] %[DocPath] macros not working?

Post by Maciej Tokarski »

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

Re: %[DocName] %[DocPath] macros not working?

Post by Tracker Supp-Stefan »

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
User avatar
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?

Post by Ivan - Tracker Software »

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
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.
Maciej Tokarski
User
Posts: 23
Joined: Mon Feb 09, 2009 8:52 am

Re: %[DocName] %[DocPath] macros not working?

Post by Maciej Tokarski »

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

Re: %[DocName] %[DocPath] macros not working?

Post by Tracker Supp-Stefan »

We will be waiting for those comments Maciej
:)

Best,
Stefan
Maciej Tokarski
User
Posts: 23
Joined: Mon Feb 09, 2009 8:52 am

Re: %[DocName] %[DocPath] macros not working?

Post by Maciej Tokarski »

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

Re: %[DocName] %[DocPath] macros not working?

Post by Tracker Supp-Stefan »

Hi Maciej,

I will make a note to the guys responsible for the manuals to have this included in the next revision.

Best,
Stefan
Post Reply