I want the report to automatically save PDF after they print a report with the regular printer! I also want them to be able to filter the report before printing (and saving to PDF), so I need to RUN the report WITH ReqWindow. This whole thing is completely useless if this is the only way to save to PDF:
I want the user to Filter the report, change stuff on ReqForm and then print it. The PDFCreator needs to create a PDF copy of the printed report and put it on server.
because NAV ignores the system printer when request form opens up. It doesn't send it to the default printer. The user gets a printer selection window and they have to choose the printer.
Ahmed Rashed Amini
Independent Consultant/Developer
I was experiencing the “It is not possible to assign a _clsPDFCreatorOptions to a clsPDFCreatorOptions” error each time there was a PDFCreator upgrade.
Recompiling the object fixed the problem, but all users had to be on the exact same version.
I knew it was an idiosyncrasy of the Navision assignment:
PDFCreatorOption := PDFCreator.cOptions;
I looked for a different, more forgiving, way to assign one to the other.
I found that using a Variant (V) as an intermediary solves the problem:
V := PDFCreator.cOptions;
PDFCreatorOption := V;
CLEAR(V);
You MUST clear the variant after the assignment, or PDFCreator.EXE will not shutdown at the end of the process.
I’ve tried it with several version of PDFCreator and is seems to be working.
I have just rolled it out at a client with multiple PDFCreator versions. If they still have problems I will let you know.
I've problem with PDFCreator version 1.2.3.
No file was created.
This is my code:
Window.OPEN('processing');
WindowisOpen := TRUE;
IF FileName = '' THEN
ERROR('Please specify what the file should be saved as');
Object.GET(Object.Type::Report,'',ReportID);
PDFCreatorOption := PDFCreator.cOptions;
PDFCreatorOption.UseAutosave := 1;
PDFCreatorOption.UseAutosaveDirectory := 1;
PDFCreatorOption.AutosaveDirectory := FileDirectory;
PDFCreatorOption.AutosaveFormat := 0; //PDF file, you can also save in other formats
PDFCreatorOption.AutosaveFilename := FileName;
I was experiencing the “It is not possible to assign a _clsPDFCreatorOptions to a clsPDFCreatorOptions” error each time there was a PDFCreator upgrade.
Recompiling the object fixed the problem, but all users had to be on the exact same version.
I knew it was an idiosyncrasy of the Navision assignment:
PDFCreatorOption := PDFCreator.cOptions;
I looked for a different, more forgiving, way to assign one to the other.
I found that using a Variant (V) as an intermediary solves the problem:
V := PDFCreator.cOptions;
PDFCreatorOption := V;
CLEAR(V);
You MUST clear the variant after the assignment, or PDFCreator.EXE will not shutdown at the end of the process.
I’ve tried it with several version of PDFCreator and is seems to be working.
I have just rolled it out at a client with multiple PDFCreator versions. If they still have problems I will let you know.
=D> =D> =D>
Thank you. So far that is the only really issue with PDF creator that I couldn't solve. And my biggest issue is having customers using different versions of PDF Creator so its difficult to keep track of.
Thanks to Rashed for this solution. I am using it for a client who is on NAV 2009 with RTC. They want to print check stubs to PDF without any user intervention. It works beautifully in Classic, but in RTC the BullZip prompt comes up for each PDF, asking for path and filename. ](*,)
Can anyone see what I've done wrong here or is there an issue in RTC that makes this impossible?
I tried to save Navision Reports using eDocPrintPro version 3.17.4. Works fine with Windows Server 2003 but I can't get it to work with Windows Server 2008 although the website claims that it's supported.
Modified the functionality to make use of BullZip now everything works fine under both Windows Server 2003 and 2008.
In case anyone else has this problem - for about 8 hours today I couldn't get PDFCreator v1.3.2 to run on a Terminal Server (2008 R2 64) running NAV 2009 R2 Classic. I could print normally from the report to PDF from the print dialogue and I could instantiate the exe, set options, generate test files etc via COM/Automation using Rashed's script but I could not print the actual report to a PDF - could see the exe in task manager but no jobs were ever added. No error messages/error events, only an eventual time out/forcefully having to kill the process.
Turns out the only way I got it to work was by setting PDFCreator.exe to always run as Administrator and then running NAV itself as Administrator.
Hopefully this will save somebody else a few hours. I'll post a follow up if/when I come up with a better solution/explanation. Any hits/tips highly appreciated.
Installing with administrator privileges with this feature enabled (default) will result in the printer spool directory being in a different directory than for your regular user (without administrator privileges). Running PDFCreator without admin privileges will then result in the application looking in the wrong place for the postscript files. Finally figured this out by using ProcessMonitor.
You can see the difference in what the %TEMP% variable is set to from command prompt by running set temp, then try running cmd.exe as administrator and you will most probably get a slightly different path.
Follow solutions in the link above and it will work like a charm. Hope this saves someone a few hours
Comments
i rewrite my CU to use Bullzip instead of PDFCreator. Maybe it is easier to merge documents with Bullzip and the CU ...
OK, here we go: i wanted to merge the created PDF with another PDF document file - as watermark or stamp and tried the following parameters:
BullzipPDF.SetValue('Superimpose', 'C:\watermark.pdf');
BullzipPDF.SetValue('SuperimposeLayer', 'bottom');
what should i say: it works
thankx
bigbossi
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
and not like this:
It simply does nothing and this way I can't show the ReqWindow to the user! Why?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I want the user to Filter the report, change stuff on ReqForm and then print it. The PDFCreator needs to create a PDF copy of the printed report and put it on server.
OnPreRepot copy the filters to global record variable.
write function in the report to return the global record variables all the filters. Add them as parameter as reference
So now that you have your filters.
afterwards
REPORT.RUNMODAL(ReportSelection."Report ID",FALSE,TRUE,SalesHeaderWithFilter);
This may be useless to you if you don't know how solve your problem.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Thanks again!
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Recompiling the object fixed the problem, but all users had to be on the exact same version.
I knew it was an idiosyncrasy of the Navision assignment:
PDFCreatorOption := PDFCreator.cOptions;
I looked for a different, more forgiving, way to assign one to the other.
I found that using a Variant (V) as an intermediary solves the problem:
V := PDFCreator.cOptions;
PDFCreatorOption := V;
CLEAR(V);
You MUST clear the variant after the assignment, or PDFCreator.EXE will not shutdown at the end of the process.
I’ve tried it with several version of PDFCreator and is seems to be working.
I have just rolled it out at a client with multiple PDFCreator versions. If they still have problems I will let you know.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I've problem with PDFCreator version 1.2.3.
No file was created.
This is my code:
Window.OPEN('processing');
WindowisOpen := TRUE;
IF FileName = '' THEN
ERROR('Please specify what the file should be saved as');
Object.GET(Object.Type::Report,'',ReportID);
PDFCreatorOption := PDFCreator.cOptions;
PDFCreatorOption.UseAutosave := 1;
PDFCreatorOption.UseAutosaveDirectory := 1;
PDFCreatorOption.AutosaveDirectory := FileDirectory;
PDFCreatorOption.AutosaveFormat := 0; //PDF file, you can also save in other formats
PDFCreatorOption.AutosaveFilename := FileName;
PDFCreator.cOptions := PDFCreatorOption;
PDFCreator.cClearCache();
DefaultPrinter := PDFCreator.cDefaultPrinter;
PDFCreator.cDefaultPrinter := 'PDFCreator';
PDFCreator.cPrinterStop := FALSE;
REPORT.RUNMODAL(ReportID,FALSE,TRUE);
Window.CLOSE;
=D> =D> =D>
Thank you. So far that is the only really issue with PDF creator that I couldn't solve. And my biggest issue is having customers using different versions of PDF Creator so its difficult to keep track of.
Can anyone see what I've done wrong here or is there an issue in RTC that makes this impossible?
BTW, I have set BullZip as the default printer AND configured in printer selections. It doesn't work either way.
You can just call
Report.saveaspdf and save it to a folder.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I tried to save Navision Reports using eDocPrintPro version 3.17.4. Works fine with Windows Server 2003 but I can't get it to work with Windows Server 2008 although the website claims that it's supported.
Modified the functionality to make use of BullZip now everything works fine under both Windows Server 2003 and 2008.
Maybe this reply saves someone time
Turns out the only way I got it to work was by setting PDFCreator.exe to always run as Administrator and then running NAV itself as Administrator.
Hopefully this will save somebody else a few hours. I'll post a follow up if/when I come up with a better solution/explanation. Any hits/tips highly appreciated.
Installing with administrator privileges with this feature enabled (default) will result in the printer spool directory being in a different directory than for your regular user (without administrator privileges). Running PDFCreator without admin privileges will then result in the application looking in the wrong place for the postscript files. Finally figured this out by using ProcessMonitor.
You can see the difference in what the %TEMP% variable is set to from command prompt by running set temp, then try running cmd.exe as administrator and you will most probably get a slightly different path.
Follow solutions in the link above and it will work like a charm. Hope this saves someone a few hours
Could not load the selected library. :!:
you cannot enter "item list" in Report No.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I thought i must update as i got the information.
"could not load the selected type library"
Please can you help me out.
Maurice
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Can anyone give me an example on how to use the GhostScript Automation object in Navison to print PDF?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n