Save Nav Reports to PDF
1st August 2008
A while back I wrote an example on how to save Navision reports automatically to pdf files using PDFCreator. PDFCreator isn’t really well supported on Vista and in 64 bit environment.
Some people have also reported problems using PDFCreator.
So this blog is about a second solution. I’m using for this exampel BullZip. Which is a freeware.
Here are some of BullZip feature.
Print to PDF from almost any Windows program.
Runs on Microsoft Windows 2000/XP/XP x64/2003/2003 x64/Vista/Vista x64/2008.
Supports 64-bit operating systems.
Direct output to the same file each time or prompt for destination.
Here is example Form. I’ve coded. BullZip.
Here is the function
PROCEDURE PrintToBullZip@1000000000();
BEGIN
IF ISCLEAR(BullZipPDF) THEN
CREATE(BullZipPDF);
ReportID := REPORT::"Customer - List";
FileDirectory := 'C:\';
Window.OPEN('processing Cusomer ######################1##');
Object.GET(Object.Type::Report,'',ReportID);
IF Customer.FINDSET THEN REPEAT
Window.UPDATE(1,Customer."No.");
FileName := Customer."No." + '.pdf';
BullZipPDF.Init;
BullZipPDF.LoadSettings;
RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE);
BullZipPDF.SetValue('Output',FileDirectory+FileName);
BullZipPDF.SetValue('Showsettings', 'never');
BullZipPDF.SetValue('ShowPDF', 'no');
BullZipPDF.SetValue('ShowProgress', 'no');
BullZipPDF.SetValue('ShowProgressFinished', 'no');
BullZipPDF.SetValue('SuppressErrors', 'yes');
BullZipPDF.SetValue('ConfirmOverwrite', 'no');
BullZipPDF.WriteSettings(TRUE);
Customer2 := Customer;
Customer2.SETRECFILTER;
REPORT.RUNMODAL(ReportID,FALSE,FALSE,Customer2);
TimeOut := 0;
WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN
SLEEP(1000);
TimeOut := TimeOut + 1;
END;
UNTIL Customer.NEXT = 0;
Window.CLOSE;
END;
Make sure you set Bullzip as default printer, or set it up in Printer Selection for the user or report.
Download Bullzip PDF Printer and install it. Import the form.txt file into NAV and compile it and run it. The example will loop through customers and create one pdf document per customer.
Here is the Bullzip link
April 2nd, 2009 at 2:55 pm
When the code is executed by the NAS, it seems the RunOnceFile is not deleted.
TimeOut := 0;
WHILE EXISTS(RunOnceFile) AND (TimeOut < 30) DO BEGIN
SLEEP(1000);
TimeOut := TimeOut + 1;
END;
I see in the logs that the NAS is always waiting for 30 seconds. And on the NAS server, the RunOnceFile is not removed. These files exists in 2 locations:
C:\Documents and Settings\NASUser\Application Data\Bullzip\PDF Printer\runonce@Bullzip PDF Printer.ini
C:\Documents and Settings\NASUser\Bullzip\PDF Printer\runonce@Bullzip PDF Printer.ini
Is this normal behaviour?
May 18th, 2009 at 9:01 am
Hi,
First of all well done for this pdf creator it’s really good. Is it possible to add a pdf background? I know this is possble manually, can it be done automatically as well?
Best Regards,
Steve
May 25th, 2009 at 9:19 pm
Hey, do you know how determine the page size using bullzip?, I need a diferent size for two reports to print in the same printer. Thank’s.
Regards, Roberto
June 11th, 2009 at 6:39 pm
I haven’t looked at page size, you can search bullzip forums.
June 12th, 2009 at 7:42 am
Concerning image background and other “musthaves” there are other nice freeware solutions:
FreePDF: allows background images and you can automatically open a mail client with the attached file)
qvPDF: additionally allows control sequences to submit the mail address, subject, etc., e.g.
June 15th, 2009 at 7:34 pm
with BullZip can you programmatically make BullzipPDF the default printer, print your report, then change the default printer back to what the user had originally?
June 16th, 2009 at 12:19 pm
I don’t think you can, but you can use NAV report selection to setup the report to print to specific printer.
December 4th, 2009 at 7:29 am
Bullzip needs a lot of time to initialize. More than a minute.
It seems that the following code line is causing the problem.
BullZipPDF.LoadSettings;
Anyone else with the same experience?
December 15th, 2009 at 11:38 pm
hi Rashed, first of all..
thks for the article. works nicely.
and i want to ask, is it possible to add the digital signature in the code?
where can i find the documentation?
thks
February 12th, 2010 at 10:40 am
Just wanted to point out the BullZip is only free for up to 10 users. If you have more, you have to purchase the commercial product.
April 5th, 2010 at 3:44 pm
Someone pointed me here from the forums. Great article. Bullzip is much better than CutePDF. So many more options!
April 15th, 2010 at 9:26 pm
still cannot figure out nav job queue. new at NAV. i installed NAS and created a job queue to run report aged receivable. nothing happends gives me error. basically what i want to do is end of the month i want to run aged receivable and aged payable and print to pdf automatically and save it somewhere on the server. can someone tell me the steps please.
April 15th, 2010 at 11:48 pm
I suggest to post the question on www.mibuso.com/forum you’ll get your answers. All Job queue is that it run your object at certain time. as far as saving report to a folder or somewhere, Job queue will not do that. You have to write the code to do it.
July 27th, 2010 at 2:19 am
Thank you sir for this wonderful contribution.
Are there known issues with Bullzip, navision and windows 7?
I’ve tried this in Windows XP and everything worked fine. I have recently upgraded my machine to Windows 7, and now the code doesn’t create the PDF File to the folder that i’ve specified.
Do I need to tweak something in the code to make this work? I’m running it on Nav 4.00 SP3.
July 27th, 2010 at 6:03 am
I haven’t tried it on a windows 7 yet. I am still running windows xp.
Take a look at this page for registry settings on where the runonce.ini file is created and see where the file is created.
http://www.biopdf.com/guide/configuration_files.php
August 2nd, 2010 at 10:58 am
Can some one please explain how do i accomplish this step :–
—————————————
Import the form.txt file into NAV and compile it and run it
—————————————
Where do i import this file to ? and how do i compile it and how do i run it.
My apologies for the noob query
August 2nd, 2010 at 11:24 am
In Dynamics NAV. Click on Tools->object designer. A new window will open up with list of all object make sure you don’t have the object in your existing database if you do, change it form.txt file to a different number.
Once the Object desinger is opened, Click on File->Import. Select the txt file. Once the file is imported, find the object in object designer and click on F11. this will compile the object. Then Run the object.
August 2nd, 2010 at 12:50 pm
Thank you for the prompt response, BUT what is the OBJECT that i should look out for so that it does not exist ?
Thank you once again.
August 28th, 2010 at 10:37 pm
in actual version of Bullzip (7.x) , GetSettingsFileName does not exists…
January 25th, 2011 at 11:04 pm
Hi Rashed,
I have the code above running after modification on NSA, as Luc said the runonce is not getting deleted and in my case I’m not getting the PDF out, what is happening is I can see the PS file in a temp location, but never converted to PDF!!! Any Advice?
Regards
January 26th, 2011 at 12:02 am
Make sure the NAS user is local admin. Also what OS are you running this on?
January 26th, 2011 at 12:53 am
It’s a windows 2003 server SP2, and I had added the NAV sys to local admin, and it worked.
Thanks a lot
January 26th, 2011 at 9:56 am
You are welcome.
April 10th, 2011 at 4:18 am
how can we add the setting of PDFCreator through *.ini files
April 10th, 2011 at 8:19 pm
This blog is about bullzip. I suggest to post the question on mibuso forum or pdfcreator forum.
The settings are done through the pdfcreator dll file.