How to save Navision Reports as PDF

145679

Comments

  • bigbossibigbossi Posts: 3Member
    Hi together,

    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 :lol:

    thankx
    bigbossi
  • ara3nara3n Posts: 9,147Member
    I'm glad you got it working and welcome to mibuso.
  • nandunandu Posts: 1Member
    where acyually i hav to import this file
  • ara3nara3n Posts: 9,147Member
    which file are you referring too?
  • miksy123miksy123 Posts: 10Member
    Why does it only work if I start the report like this:
    REPORT.RUNMODAL(ReportSelection."Report ID",FALSE,TRUE,SalesHeader);
    

    and not like this:
    REPORT.RUNMODAL(ReportSelection."Report ID",TRUE,TRUE,SalesHeader);
    

    It simply does nothing and this way I can't show the ReqWindow to the user! Why?
  • ara3nara3n Posts: 9,147Member
    If you want to show the report to the user, then they can choose the pdf printer and can save it themselves, you don't need to modify anything.
  • miksy123miksy123 Posts: 10Member
    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:
    REPORT.RUNMODAL(ReportSelection."Report ID",FALSE,TRUE,SalesHeader);
    

    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.
  • ara3nara3n Posts: 9,147Member
    Run first the report at the begging. the user will put his her filter.
    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.
  • miksy123miksy123 Posts: 10Member
    Thanks...but I would like to know why this doesn't work! Here is my thread about this viewtopic.php?f=5&t=47245

    Thanks again!
  • ara3nara3n Posts: 9,147Member
    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.
  • tommerricktommerrick Posts: 1Member
    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.
  • ara3nara3n Posts: 9,147Member
    Thanks for sharing. :)
  • clemboclembo Posts: 116Member
    Hi guys,

    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;
  • David_SingletonDavid_Singleton Posts: 5,367Member
    tommerrick wrote:
    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.
    David Singleton
  • kevinjose356kevinjose356 Posts: 1Member
    hmm i think you are right but what's the exact problem with PDF ?
  • lloydsmodslloydsmods Posts: 93Member
    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?
    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', 'no');
    BullZipPDF.SetValue('ConfirmOverwrite', 'no');
    BullZipPDF.WriteSettings(TRUE);
    
    PayCheckLedger2 := PayCheckLedger;
    PayCheckLedger.SETRECFILTER;
    
    REPORT.RUNMODAL(ReportID,FALSE,FALSE,PayCheckLedger);
    

    BTW, I have set BullZip as the default printer AND configured in printer selections. It doesn't work either way.
    If guns cause crime mine must be defective.
  • ara3nara3n Posts: 9,147Member
    On RTC you don't need bullzip.

    You can just call

    Report.saveaspdf and save it to a folder.
  • lloydsmodslloydsmods Posts: 93Member
    Thanks for your help! I totally overlooked that command. I coded an IF ISSERVICETIER loop to use BullZip if running from classic (just in case).
    If guns cause crime mine must be defective.
  • MaximusMaximus Posts: 105Member
    FYI.

    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 :)
  • he21nrikhe21nrik Posts: 4Member
    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.
  • he21nrikhe21nrik Posts: 4Member
    Turns out the issue is related to this: http://support.microsoft.com/kb/243555

    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 :)
  • LambaLamba Posts: 259Member
    I getting the following error on compiling:

    Could not load the selected library. :!:
  • LambaLamba Posts: 259Member
    Resolved the error..But the new one is that

    you cannot enter "item list" in Report No.
  • ara3nara3n Posts: 9,147Member
    use a different report. any report that you want to save as pdf.
  • David_SingletonDavid_Singleton Posts: 5,367Member
    Lamba wrote:
    Resolved the error..But the new one is that

    you cannot enter "item list" in Report No.
    Try
    REPORT::"Item List"
    
    David Singleton
  • LambaLamba Posts: 259Member
    Now a hotfix from Microsoft is available for Nav 2009 Sp1 and Nav R2.
    I thought i must update as i got the information.
  • mpmauricempmaurice Posts: 6Member
    I have imported the form, but when I compile it I get an error message
    "could not load the selected type library"
    Please can you help me out.
    Maurice
  • ara3nara3n Posts: 9,147Member
    go to globals and reselect the automation variable for pdfcreator.
  • G8torG8tor Posts: 29Member
    Has anyone used GhostScript to print PDF in Navistion?

    Can anyone give me an example on how to use the GhostScript Automation object in Navison to print PDF?
  • ara3nara3n Posts: 9,147Member
    pdfcreator is using GhostScript to generate the pdf documents
Sign In or Register to comment.