This is what I added to make Bullzip default printer.
IF NOT lPrinterSelection.GET('',lReportID) THEN BEGIN
lPrinterSelection.INIT;
lPrinterSelection."Report ID" := lReportID;
lPrinterSelection."Printer Name" := 'Bullzip PDF Printer';
lPrinterSelection.INSERT;
END;
Works great!
Thanx again.
Maarten
Here is the code.
Ahmed Rashed Amini
Independent Consultant/Developer
Ok, everything works so far but the only thing that's kind of strange is the fact that somethime a "0" reference for the bullzip printer is created in the printer selection.
I have been lurking in this thread for a little while, and I'd like to thank Rashed for this contribution!
I've been dabbling with bullzip for a bit, myself now. What I was curious about, were the settings that one can use for Bullzip (such as ShowPDF, ShowProgressFinished,...) It might have been posted before, but I've looked through this thread before and haven't found it as of yet:
These are the settings that can be used as the .SetValue('configname', 'configvalue'); parameters.
Rashed already incorporated those of most value, but maybe someone else out there could make use of another parameter.
RememberLastFileName, RemeberLastFolderName, ShowSaveAs, etc... might improve the usability for your users. It also seems possible to embed watermarks, merge PDF files, password-protect files, you can even pass on the way the document is supposed to be viewed in the default viewer, after output (though not all viewers might accept those parameters).
Do note, the above website is for bioPDF, the commercial "branch" for BullZip, though the functions seem to remain the same, from what I have been able to test.
The only thing I'm missing, is a mail function... Anyone had any luck on that with BullZip?
Thank you for the warm welcome! Truth is, I have posted here before, rarely. But it seems I forgot the account details...
And, you're welcome. Whatever I can do to attribute to your awesome post.
I'm not quite a developer. I do mess around in code very now and then, but could you point me in the right direction to look into SMTP from within NAV?
I noticed that it's possible to automatically execute a .VBS script whilst parsing the report to PDF. I had considered using a .VBS script to launch an emailer of some sort. But I'd rather keep my code IN NAV.
What version are you on? If you are current on your maintenance/license and you are on older version, you can get CU 400 table/form 409 from 5.0 sp1 and load them into your version. You also need to register/copy Microsoft.Navision.Mail.dll, Microsoft.Navision.Mail.tlb.
Once you have done this. Then you can use CU 400 to send email.
This thread is really a great contribution to the knowledge of the community. But, before you code your solution there should be some general considerations allowed:
1.) How to save Navision Reports as PDF (the original theme, remember) - this question (or How To) is easy to answer. There are many solutions on the market, many of them are free, some of them you will more like than others... - may be your customer will already have one of these solutions installed on his computers..
2.) What do you want to do with the created PDF file? May be, you want to attach it to a mail, put it into an archive, fax it (yes, this is possible) - there should be all possibilities open.
3.) If there is a solution for NAV, handling, creating, printing, mailing, etc. PDF files, it should be as "general" as possible? Why? If you are fixed to one PDF solution (PDFCreator, bullzip,...), your solution may work for the moment. But what about the future? Next versions may not be free anymore, there may be other problems with operating systems (Vista), e.g. - Wouldn't it be nice to have a solution for NAV working with an arbitrary PDF creator? What kind of basic functionality should this PDF creator provide? The only thing, we need is the capability to create a PDF file from a NAV report. - this file could have a fixed name (in the simplest case). Fortunately almost every "PDF creator solution" can accomplish this in the most simplest way, in form of a printer driver which is configured to print to a file (there is no automation component necessary).
4.) The PDF solution for NAV should be as simple as possible. If you want for example attach the print result of a report to a mail as a PDF file, it should not be necessary to design the report in any way (except if you want to initialise the mailaddress, of course).
All these considerations (and a few more) have led us to the decision to develop a "general" tool, where the mail (SMTP or MAPI) and fax issues integrate as naturally into the application as the printing process. I will soon present this tool in the product directory...
What version are you on? If you are current on your maintenance/license and you are on older version, you can get CU 400 table/form 409 from 5.0 sp1 and load them into your version. You also need to register/copy Microsoft.Navision.Mail.dll, Microsoft.Navision.Mail.tlb.
Once you have done this. Then you can use CU 400 to send email.
Awesome! Thanks Rashed. I'm trying to accomplish the PDF export in a 5.01 environment, with a developers license, so I think I'm good to go.
Thanks again for your valuable input. You're really helping a NAV newbie out, here
@gerdhuebner:
I can only speak for myself here, but I think this thread was specifically created for all the people that were asking about creating a PDF from within NAV?
I've tried Bullzip with good luck - but have a problem as I need to print both A4 PDF and a local page size. I've set up the "local page size" in a extra instance of the Bullzip pdf printer - called PDF-FLG. But I cannot get NAV to find this. I've tried the below code:
Bullzip does not have a setting to set default printer. So you will need to use navision printer selection to set which report nav will use to print the report.
IF NOT lPrinterSelection.GET('',lReportID) THEN BEGIN
lPrinterSelection.INIT;
lPrinterSelection."Report ID" := lReportID;
lPrinterSelection."Printer Name" := 'Bullzip PDF Printer'; //change this to print to PDF-FLG for specific page size.
lPrinterSelection.INSERT;
END;
Ahmed Rashed Amini
Independent Consultant/Developer
Sorry Rashed,
I didn't think of this because your example code on your blog is made from a form. Of course - that's the way to do it - as a "normal" printer!
When I print to a matrix printer it uses another font than when I make a preview of the document - or open the PDF. Do you have any ideas?
And thank you again!
I gave up searching for solution myself, so this thread is my last hope.
I have to make such thing: to make a report in excel then save it to PDF and then send it by email, but most importantly - it has to be done without any user intervention.
First job is done: there is an excel report. Now I'm struggling with the second (email option is my last concern). I am using PDFCreator and when I try to print a file in a particular directory, PDFCreator opens default program (in this case Excel), shows that tiny print dialog window, prints the file to the appropriate directory (user doesn't have to do anything even all of the windows appear), but when it finishes printing, it closes current workbook, but blank Excel window is STILL hanging on the screen and I can't figure out how to close that damn thing. Maybe you have some kind of life-saving ideas?
Here is the piece of code that I use:
IF ISCLEAR(pdfCreatorApp) THEN
CREATE(pdfCreatorApp);
IF ISCLEAR(pdfCreatorOptions) THEN
CREATE(pdfCreatorOptions);
XlWrkBk.SaveCopyAs(ENVIRON('TEMP') + '\' + XlWrkBk.Name + '.xlsx');
ExcelFileName := XlWrkBk.Name;
XlWrkBk.Close(FALSE);
XlApp.Quit;
IF pdfCreatorApp.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN BEGIN
globalErrDescriptionTxt := 'Status: Error: ' + pdfCreatorError.Description;
ERROR(globalErrDescriptionTxt);
END;
Not too sure if I have miss out any thread on why the PDF Creator hangs and is unable to execute the PDFCreator.cClose(). I am working on NAV 3.60 with PDF Creator version 0.9.6.
I have another customer on NAV4.0SP3 with PDF Creator version 0.9.3 and that is working fine.
Can anyone advice?
Is there anyone that can advice me as I need to urgently revert back to my user. It only hangs when it is printing the report with a range of records. If I am to print by per record it is fine.
Hi, I have a problem using pdfcreator automation. In a form I do something like this:
" PDFCreatorOption := PDFCreator.cOptions; "
where
PDFCreator is the automation 'PDFCreator'.clsPDFCreator
and
PDFCreatorOption is the Automation 'PDFCreator'.clsPDFCreatorOptions.
If I compile the Form under Vista and I use it on the same operating system it works, but if i use the same Form under XP it doesn't works and Nav gives me an error on that code line. I have to ricompile it under XP and then it works on XP but not on Vista!
Any suggestion?
Thanks a lot and sorry for my english...
A week ago I was trying to use PDF Creator in a batch process to create many PDF invoices. While the batch process was running I wanted to test what happens if I would print another document to PDF Creator. What I was afraid of happened. An invoice that was created in the batch process was overwritten with the document I printed to the PDF Creator. It's a matter of timing which document overwrites the other one.
The bullzip PDF printer mentioned the other posts does not have this problem due to the local runonce file that is created when used in batch mode.
I am trying to run the code for PDF Creator.
I have installed the latest PDF Creatror (0_9_8). But i am getting the Error which is saying.
Staus: Error[4] GhostScript Error: -'100'!.
I dont know why this error is coming as I have done this before but that was under XP and now I am trying with vista.
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Also delete the 0 record first.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I've been dabbling with bullzip for a bit, myself now. What I was curious about, were the settings that one can use for Bullzip (such as ShowPDF, ShowProgressFinished,...) It might have been posted before, but I've looked through this thread before and haven't found it as of yet:
http://www.biopdf.com/guide/settings.php
These are the settings that can be used as the .SetValue('configname', 'configvalue'); parameters.
Rashed already incorporated those of most value, but maybe someone else out there could make use of another parameter.
RememberLastFileName, RemeberLastFolderName, ShowSaveAs, etc... might improve the usability for your users. It also seems possible to embed watermarks, merge PDF files, password-protect files, you can even pass on the way the document is supposed to be viewed in the default viewer, after output (though not all viewers might accept those parameters).
Do note, the above website is for bioPDF, the commercial "branch" for BullZip, though the functions seem to remain the same, from what I have been able to test.
The only thing I'm missing, is a mail function... Anyone had any luck on that with BullZip?
And thanks for the link and welcome to mibuso with your first post.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
And, you're welcome. Whatever I can do to attribute to your awesome post.
I'm not quite a developer. I do mess around in code very now and then, but could you point me in the right direction to look into SMTP from within NAV?
I noticed that it's possible to automatically execute a .VBS script whilst parsing the report to PDF. I had considered using a .VBS script to launch an emailer of some sort. But I'd rather keep my code IN NAV.
Once you have done this. Then you can use CU 400 to send email.
The code will look like this.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
1.) How to save Navision Reports as PDF (the original theme, remember) - this question (or How To) is easy to answer. There are many solutions on the market, many of them are free, some of them you will more like than others... - may be your customer will already have one of these solutions installed on his computers..
2.) What do you want to do with the created PDF file? May be, you want to attach it to a mail, put it into an archive, fax it (yes, this is possible) - there should be all possibilities open.
3.) If there is a solution for NAV, handling, creating, printing, mailing, etc. PDF files, it should be as "general" as possible? Why? If you are fixed to one PDF solution (PDFCreator, bullzip,...), your solution may work for the moment. But what about the future? Next versions may not be free anymore, there may be other problems with operating systems (Vista), e.g. - Wouldn't it be nice to have a solution for NAV working with an arbitrary PDF creator? What kind of basic functionality should this PDF creator provide? The only thing, we need is the capability to create a PDF file from a NAV report. - this file could have a fixed name (in the simplest case). Fortunately almost every "PDF creator solution" can accomplish this in the most simplest way, in form of a printer driver which is configured to print to a file (there is no automation component necessary).
4.) The PDF solution for NAV should be as simple as possible. If you want for example attach the print result of a report to a mail as a PDF file, it should not be necessary to design the report in any way (except if you want to initialise the mailaddress, of course).
All these considerations (and a few more) have led us to the decision to develop a "general" tool, where the mail (SMTP or MAPI) and fax issues integrate as naturally into the application as the printing process. I will soon present this tool in the product directory...
Awesome! Thanks Rashed. I'm trying to accomplish the PDF export in a 5.01 environment, with a developers license, so I think I'm good to go.
Thanks again for your valuable input. You're really helping a NAV newbie out, here
@gerdhuebner:
I can only speak for myself here, but I think this thread was specifically created for all the people that were asking about creating a PDF from within NAV?
http://mibuso.com/blogs/ara3n/2009/06/1 ... amics-nav/
All the solution are available. I guess they just need to be put together.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
thanx for this very informative post, Rashed!
I've tried Bullzip with good luck - but have a problem as I need to print both A4 PDF and a local page size. I've set up the "local page size" in a extra instance of the Bullzip pdf printer - called PDF-FLG. But I cannot get NAV to find this. I've tried the below code:
FileName := SH."No." + '.pdf';
BullZipPDF.SetPrinterName('PDF-FLG');
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);
SH2 := SH;
SH2.SETRECFILTER;
REPORT.RUNMODAL(ReportID,FALSE,FALSE,SH2);
Hoping that the SETPRINTERNAME would help - but it doesn't seem to make any difference.
Are there other ways of making this happen?
Henrik Frederiksen, Denmark
Bullzip does not have a setting to set default printer. So you will need to use navision printer selection to set which report nav will use to print the report.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I didn't think of this because your example code on your blog is made from a form. Of course - that's the way to do it - as a "normal" printer!
When I print to a matrix printer it uses another font than when I make a preview of the document - or open the PDF. Do you have any ideas?
And thank you again!
Henrik Frederiksen, Denmark
I suggest to get a new printer.
It is much cheaper than messing with dot matrix printer.
I didn't think dot matrix could print in different fonts.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
http://www.mibuso.com/pdinfo.asp?FileID=249
I gave up searching for solution myself, so this thread is my last hope.
I have to make such thing: to make a report in excel then save it to PDF and then send it by email, but most importantly - it has to be done without any user intervention.
First job is done: there is an excel report. Now I'm struggling with the second (email option is my last concern). I am using PDFCreator and when I try to print a file in a particular directory, PDFCreator opens default program (in this case Excel), shows that tiny print dialog window, prints the file to the appropriate directory (user doesn't have to do anything even all of the windows appear), but when it finishes printing, it closes current workbook, but blank Excel window is STILL hanging on the screen and I can't figure out how to close that damn thing. Maybe you have some kind of life-saving ideas?
Here is the piece of code that I use:
IF ISCLEAR(pdfCreatorApp) THEN
CREATE(pdfCreatorApp);
IF ISCLEAR(pdfCreatorOptions) THEN
CREATE(pdfCreatorOptions);
XlWrkBk.SaveCopyAs(ENVIRON('TEMP') + '\' + XlWrkBk.Name + '.xlsx');
ExcelFileName := XlWrkBk.Name;
XlWrkBk.Close(FALSE);
XlApp.Quit;
IF pdfCreatorApp.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN BEGIN
globalErrDescriptionTxt := 'Status: Error: ' + pdfCreatorError.Description;
ERROR(globalErrDescriptionTxt);
END;
pdfCreatorApp.cClearCache();
pdfCreatorApp.cVisible := FALSE;
DefaultPrinter := pdfCreatorApp.cDefaultPrinter;
pdfCreatorApp.cDefaultPrinter := 'PDFCreator';
pdfCreatorOptions := pdfCreatorApp.cOptions;
pdfCreatorOptions.UseAutosave := 1;
pdfCreatorOptions.UseAutosaveDirectory := 1;
pdfCreatorOptions.AutosaveDirectory := ENVIRON('TEMP');
pdfCreatorOptions.AutosaveFilename := ExcelFileName;
pdfCreatorOptions.AutosaveFormat := 0;
pdfCreatorApp.cSaveOptions := pdfCreatorOptions;
pdfCreatorApp.cPrinterStop := FALSE;
pdfCreatorApp.cPrintFile(ENVIRON('TEMP') + '\' + ExcelFileName + '.xlsx');
pdfCreatorApp.cPrinterStop := TRUE;
pdfCreatorApp.cDefaultPrinter := DefaultPrinter;
// Everything is done except Excel window is still in front of my eyes.
//Clearing Objects
P.S. Could somebody explain me, what does that property CPrinterStop do...?
Not too sure if I have miss out any thread on why the PDF Creator hangs and is unable to execute the PDFCreator.cClose(). I am working on NAV 3.60 with PDF Creator version 0.9.6.
I have another customer on NAV4.0SP3 with PDF Creator version 0.9.3 and that is working fine.
Can anyone advice?
Can you pls explain this to me
Thanks
You can create a form with table of 2000000001 and you'll see all the table.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Is there anyone that can advice me as I need to urgently revert back to my user. It only hangs when it is printing the report with a range of records. If I am to print by per record it is fine.
" PDFCreatorOption := PDFCreator.cOptions; "
where
PDFCreator is the automation 'PDFCreator'.clsPDFCreator
and
PDFCreatorOption is the Automation 'PDFCreator'.clsPDFCreatorOptions.
If I compile the Form under Vista and I use it on the same operating system it works, but if i use the same Form under XP it doesn't works and Nav gives me an error on that code line. I have to ricompile it under XP and then it works on XP but not on Vista!
Any suggestion?
Thanks a lot and sorry for my english...
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
The bullzip PDF printer mentioned the other posts does not have this problem due to the local runonce file that is created when used in batch mode.
I am trying to run the code for PDF Creator.
I have installed the latest PDF Creatror (0_9_8). But i am getting the Error which is saying.
Staus: Error[4] GhostScript Error: -'100'!.
I dont know why this error is coming as I have done this before but that was under XP and now I am trying with vista.
Can you give me some idea why this is happning.
Waiting for ur reply.
Vishesh Singh
Technical Consultant