But is it possible to use the GhostScript .dll to handle the pdf printing? Or do I always have to rely on printers like PDFCreator that have some versions that are not stable?
Im running PDFCreator on Windows server 2008 and it has not been working.
Back from Antwerp and all hangovers recovered from. Annoying PDF Bullzip problem here and I can not seem to find it on Search. Perhaps the brain cells required to do so were killed on Thursday night.
I have a reporting codeunit running which a couple of Nav Clients are running at the same times on the same server. When a report is running it uses the code:
PrinterSelection.RESET;
IF NOT PrinterSelection.GET(USERID, SetupValuesCAL."Object No.") THEN BEGIN
deletePrinterSelection := TRUE;
CLEAR(PrinterSelection);
PrinterSelection."User ID" := USERID;
PrinterSelection."Report ID" := SetupValuesCAL."Object No.";
PrinterSelection."Printer Name" := 'Bullzip PDF Printer';
PrinterSelection.INSERT;
END ELSE BEGIN
resetPrinterSelection := TRUE;
PrinterSelectionBackup := PrinterSelection;
PrinterSelection."Printer Name" := 'Bullzip PDF Printer';
PrinterSelection.MODIFY;
END;
The Object No. of the report I want to auto run coming from a Setup Table.
Then I RUNMODAL the report and out it usually prints, quite often to c:\temp where it is attached to an email and sent to the relevant users. The Filename usually includes COMPANYNAME and USERID and a TimeStampe so there is 0% chance in my company of two files being created with the same file name.
I then do a little sleepy time as suggested somewhere else on the forum when I first set this up (Cant remember where now, probably this thread):
WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN
SLEEP(1000);
TimeOut := TimeOut + 1;
END;
All of this works fine 95% of the time but I have seen two behaviours I can not explain and can rarely reproduce, if at all.
1) On very rare occasions the Filename assigned to a PDF is from one client but the actual PDF itself is from another. Can never reproduce this on purpose however
2) On other occasions, reproducible but only sporadically, the Bullzip window which asks you where you want to save the PDF opens. Normally the code above sets this not to appear and sets the file path and name etc. This of course means the PDF is not created until a user manually intervenes and so the auto matic PDF creation and Email sending has failed.
Are these known issues I can not find in the search? Has anyone found solutions for them?
But is it possible to use the GhostScript .dll to handle the pdf printing? Or do I always have to rely on printers like PDFCreator that have some versions that are not stable?
Im running PDFCreator on Windows server 2008 and it has not been working.
I use Ghostscript but not the automation objects. Briefly -
1. Download Ghostscript and install
2. Install some vanilla printer driver (I use an HP laserjet 4200/4300 PCL6)
3. Download and install Redmon redirection program which will create port RPT1
4. Change the printer port to RPT1 and direct to Ghostscript using the arguments -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="C:\your path name\%d.pdf" -dBATCH -f -
5. Add the printer to NAV and select it in the code that runs the report.
6. The argument %d.pdf will create the report output with the report caption from NAV so after running the report you probably want to add code to rename the file to the customer number or whatever.
I do actually have a problem which is why I was looking through Mibuso and found this thread. I have one instance where I want to copy the pdf to a different folder with a different name. But for some reason, although the initial pdf is created OK, the COPY gives an error in NAV and creates an empty file in the target folder - anyone got any idea why this might be so?
If you are performing any action on the file after the report has completed, you need to add a sleep command to give the operating system enough time to recognize the file has been created in that directory.
An OS guru could go into more detail of what is going on behind the scenes. I have found a delay of a few seconds guarantees success.
If you are performing any action on the file after the report has completed, you need to add a sleep command to give the operating system enough time to recognize the file has been created in that directory.
An OS guru could go into more detail of what is going on behind the scenes. I have found a delay of a few seconds guarantees success.
Tried that - even with a delay of 30 seconds I get the same result.
Can you post the specific error message?
Things I would look at, depending on the error message:
1) The code sets the paramters, executes the NAV report, then does the copy
2) filename including extension is correct in the code
3) directory pathname is valid and no syntax problems
4) the process performing the operations has the permissions to write to the directory.
I usually add code to change the timestamp on the file. the NAV function returns a true if sucessful. If the file is still locked it will return a false.
Add a repeat clause.
While not SETSTAMP(Name,date,time) do
end;
Ahmed Rashed Amini
Independent Consultant/Developer
Can you post the specific error message?
Things I would look at, depending on the error message:
1) The code sets the paramters, executes the NAV report, then does the copy
2) filename including extension is correct in the code
3) directory pathname is valid and no syntax problems
4) the process performing the operations has the permissions to write to the directory.
I was a bit hasty in dismissing the sleep option: I have all the FILE operations in loops and the max number of iterations and the SLEEP time in each iteration are read from a setup record. When I increase both these values massively the COPY works OK but the whole operation is taking nearly 2 minutes.
The error message I get if I do not trap it is
You cannot use the file C:\PDFInvoices\Temp\User Folder\Customer Sales Invoice.pdf because it is already in use.
I shall try Rashed (ara3n) suggestion of using the timestamp to test if the file has been unlocked because currently I am only testing to see if it exists before trying to copy
That is a problem with the sleep operation if you have a large number of pdfs. I have found it works okay for my users.
Please let us know how Rashed's method works out for you - it sounds like a much faster option, and better than trial and error with the sleep method.
Have finally got round to trying Rashed's SETSTAMP suggestion and it works great. I previously was using file.COPY in a loop after testing that the pdf had been created and I wonder if that were somehow locking the file, because putting SETSTAMP in a loop with just the same sleep parameters (I use two, user configurable, one for the number of loops, and another for the delay time in each loop) I get no errors.
Thanks for your help Rashed.
I used to use PDF Creator and occasionally had the same problem as Mauddib with a payroll application - the file would have one employee's number as the filename but another employees payslip in it. At least the create - rename route puts a lot more of the control in NAV rather than relying on the pdf printer.
hi there,
when we print the report to pdf from Navision, is there anyway we can set the property(non-editing)/security setting of the pdf file to prevent user to edit the pdf file?
hi, I have successfully implemented the above, thanks for the solution.
I have implemented on NAV2009 using pdfcreator.
The client would like to have the pdfcreator installed only on the server and the files would be saved directly on the server too. is this possible without the NAS? I tried to select the printer as the 'Printer Selection' but it seems that only locally saved printers can be added..
sorry guys, i've a problem. I'm trying to print a classic report from NAV 2009 R2 to PDF. I readed previous posts, but i don't understand where is my mistake:
CompInfo.GET;
GeneralLedgerSetup.GET;
GeneralLedgerSetup.TESTFIELD("Accounting Books Path");
IF ISCLEAR(PDFCreator) THEN
CREATE(PDFCreator,TRUE,TRUE);
IF ISCLEAR(PDFCreatorError) THEN
CREATE(PDFCreatorError,TRUE,TRUE);
PDFCreatorError := PDFCreator.cError;
IF PDFCreator.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN
ERROR('Status: Error[' + FORMAT(PDFCreatorError.Number) + ']: ' + PDFCreatorError.Description);
PDFCreatorOption := PDFCreator.cOptions;
PDFCreatorOption.AutosaveDirectory := gVATReportSetup."VAT Path Destination";
PDFCreatorOption.AutosaveFilename := gFileName;
PDFCreatorOption.UseAutosave := 1;
PDFCreatorOption.UseAutosaveDirectory := 1;
PDFCreatorOption.AutosaveFormat := 0;
PDFCreator.cOptions := PDFCreatorOption;
PDFCreator.cSaveOptions();
PDFCreator.cClearCache();
DefaultPrinter := PDFCreator.cDefaultPrinter;
PDFCreator.cDefaultPrinter := 'PDFCreator';
PDFCreator.cPrinterStop := FALSE;
IF pComp THEN BEGIN
REPORT.RUNMODAL(50134, FALSE, TRUE);
END ELSE BEGIN
REPORT.RUNMODAL(50196, FALSE, TRUE);
END;
PDFCreator.cDefaultPrinter := DefaultPrinter;
PDFCreator.cClose;
CLEAR(PDFCreatorOption);
CLEAR(PDFCreator);
CLEAR(PDFCreatorError);
i call this function many time (15/30 times) by loop (i loop on standard 12147 italian table).
this path (PDFCreatorOption.AutosaveDirectory := gVATReportSetup."VAT Path Destination") is network address whit everyone all permission and if i try to use PDF creator whit same configuration manually, it work perfectly.
Comments
But is it possible to use the GhostScript .dll to handle the pdf printing? Or do I always have to rely on printers like PDFCreator that have some versions that are not stable?
Im running PDFCreator on Windows server 2008 and it has not been working.
http://mibuso.com/blogs/ara3n/2008/08/0 ... ts-to-pdf/
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I have a reporting codeunit running which a couple of Nav Clients are running at the same times on the same server. When a report is running it uses the code:
The Object No. of the report I want to auto run coming from a Setup Table.
I then init the Bullzip settings I require:
Then I RUNMODAL the report and out it usually prints, quite often to c:\temp where it is attached to an email and sent to the relevant users. The Filename usually includes COMPANYNAME and USERID and a TimeStampe so there is 0% chance in my company of two files being created with the same file name.
I then do a little sleepy time as suggested somewhere else on the forum when I first set this up (Cant remember where now, probably this thread):
All of this works fine 95% of the time but I have seen two behaviours I can not explain and can rarely reproduce, if at all.
1) On very rare occasions the Filename assigned to a PDF is from one client but the actual PDF itself is from another. Can never reproduce this on purpose however
2) On other occasions, reproducible but only sporadically, the Bullzip window which asks you where you want to save the PDF opens. Normally the code above sets this not to appear and sets the file path and name etc. This of course means the PDF is not created until a user manually intervenes and so the auto matic PDF creation and Email sending has failed.
Are these known issues I can not find in the search? Has anyone found solutions for them?
So give it time write.
Problem is I can not imagine how.
The Runonce file is created in the local users account. Documents/username/etc.etc.etc.
So 10 users logged into one server all printing with bullzip RunOnceFiles should not really be clashing with each other?
I have put SLEEPS and TIMEOUTS at every place I can think of. Short ones, long ones, many ones, few ones. No combination appears to be working.
I even tried to remove the "AND (TimeOut < 10)" entirely but when the problems happen the client just hangs forever then.
I am wondering if at this stage it is worth abandoning Bullzip entirely and redeveloping with a new solution. Anyone implemented anything else before?
Thanks to page2pagepro
I use Ghostscript but not the automation objects. Briefly -
1. Download Ghostscript and install
2. Install some vanilla printer driver (I use an HP laserjet 4200/4300 PCL6)
3. Download and install Redmon redirection program which will create port RPT1
4. Change the printer port to RPT1 and direct to Ghostscript using the arguments -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="C:\your path name\%d.pdf" -dBATCH -f -
5. Add the printer to NAV and select it in the code that runs the report.
6. The argument %d.pdf will create the report output with the report caption from NAV so after running the report you probably want to add code to rename the file to the customer number or whatever.
I do actually have a problem which is why I was looking through Mibuso and found this thread. I have one instance where I want to copy the pdf to a different folder with a different name. But for some reason, although the initial pdf is created OK, the COPY gives an error in NAV and creates an empty file in the target folder - anyone got any idea why this might be so?
An OS guru could go into more detail of what is going on behind the scenes. I have found a delay of a few seconds guarantees success.
http://mibuso.com/blogs/davidmachanick/
Tried that - even with a delay of 30 seconds I get the same result.
Things I would look at, depending on the error message:
1) The code sets the paramters, executes the NAV report, then does the copy
2) filename including extension is correct in the code
3) directory pathname is valid and no syntax problems
4) the process performing the operations has the permissions to write to the directory.
http://mibuso.com/blogs/davidmachanick/
Add a repeat clause.
While not SETSTAMP(Name,date,time) do
end;
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I was a bit hasty in dismissing the sleep option: I have all the FILE operations in loops and the max number of iterations and the SLEEP time in each iteration are read from a setup record. When I increase both these values massively the COPY works OK but the whole operation is taking nearly 2 minutes.
The error message I get if I do not trap it is
You cannot use the file C:\PDFInvoices\Temp\User Folder\Customer Sales Invoice.pdf because it is already in use.
I shall try Rashed (ara3n) suggestion of using the timestamp to test if the file has been unlocked because currently I am only testing to see if it exists before trying to copy
Please let us know how Rashed's method works out for you - it sounds like a much faster option, and better than trial and error with the sleep method.
http://mibuso.com/blogs/davidmachanick/
and when I want print the report, I choose the virtual printer NITRO
That 's the Link :
http://en.softonic.com/s/free-nitro-pdf-printer
Thanks for your help Rashed.
I used to use PDF Creator and occasionally had the same problem as Mauddib with a payroll application - the file would have one employee's number as the filename but another employees payslip in it. At least the create - rename route puts a lot more of the control in NAV rather than relying on the pdf printer.
i tried add variable in 2013, failed
http://mibuso.com/blogs/davidmachanick/
i follow help file
create variable name Reminder
type report
subtype Report 117 (Reminder)
i create code unit
nothing happened
Are you using client-server environment or single machine?
if clinet-server then the file will be created on system where servicetier is installed..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
my pc is as client
the service is in the server
do i need to generate from server?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
when we print the report to pdf from Navision, is there anyway we can set the property(non-editing)/security setting of the pdf file to prevent user to edit the pdf file?
Thank you.
regards,
Rachel
I have implemented on NAV2009 using pdfcreator.
The client would like to have the pdfcreator installed only on the server and the files would be saved directly on the server too. is this possible without the NAS? I tried to select the printer as the 'Printer Selection' but it seems that only locally saved printers can be added..
Any help would be appreciated.
Thanks!!
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
i call this function many time (15/30 times) by loop (i loop on standard 12147 italian table).
this path (PDFCreatorOption.AutosaveDirectory := gVATReportSetup."VAT Path Destination") is network address whit everyone all permission and if i try to use PDF creator whit same configuration manually, it work perfectly.
Please, can anyone help me?