How to save Navision Reports as PDF

2456710

Comments

  • gisongison Member Posts: 128
    Dear all,

    Does anyone can tell me how to import and compile the ara3n's code?
    Create it a codeUnit or? :-s
    thanks
  • ara3nara3n Member Posts: 9,256
    create a text file. Copy and paste the code into it. and then import the txt file into navision.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gisongison Member Posts: 128
    then it would become a Form 50100 ? :o
    thank you
  • gisongison Member Posts: 128
    Hello ara3n,
    When I compiled it, it showed me a error as [You connot enter 'Item List' in ReportNo.]
    Then the cursor jump to OnOpenForm() trigger where have a statement is
    ReportID := REPORT::"Item List";

    Did I have do anything wrong? :?: or do you have a report call "Item List"? then I need to change to any of mine?
    thank you.

    Then I cannot find the Form property soureTable is empty... is it right?
    thank you.
  • ara3nara3n Member Posts: 9,256
    Yes there is no source table for the report, and yes you can change the report to anyy of your report.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    gison wrote:
    then it would become a Form 50100 ? :o
    thank you

    You can change that to a different ID based on your license.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gisongison Member Posts: 128
    ara3n wrote:
    gison wrote:
    then it would become a Form 50100 ? :o
    thank you

    You can change that to a different ID based on your license.

    This PDFcreator demonstration is amazing.....
    I'm appreciated your kindness.
    :)
  • ara3nara3n Member Posts: 9,256
    gison wrote:
    ara3n wrote:
    gison wrote:
    then it would become a Form 50100 ? :o
    thank you

    You can change that to a different ID based on your license.

    This PDFcreator demonstration is amazing.....
    I'm appreciated your kindness.
    :)

    You are welcome. :)
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gisongison Member Posts: 128
    Hi ara3n,

    sorry...could i ask you ...what are the PDFCreator:eReady() and PDFCreator::eError? They look like function, but I cannot find it in C/AL Globals functions Form.... :?
  • ara3nara3n Member Posts: 9,256
    Those are events.

    in the global variable, when you declare the variable to the automation, you can click on property and you'll see a property called WithEvents if you set it to yes, it will show the event triggers in navision where you can put code to do certain things in an event.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gisongison Member Posts: 128
    Thanks for your patience.
    You really help me a lot.
    :o
  • gisongison Member Posts: 128
    Hi ara3n,

    I tried to change the statement "REPORT.RUNMODAL(ReportID,TRUE,TRUE)"
    which mean we can launch report with request window, but the pdf couldn't be generated. Is't always have this limitation or did I lose something?

    thank you.
  • ara3nara3n Member Posts: 9,256
    If you want to generate a pdf. you can run the report and select the pdf creator printer. No need for any code.

    This code automates the process. So that you can create many pdf documents.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • gisongison Member Posts: 128
    :| appreciate your help.
  • matias_jaurematias_jaure Member Posts: 157
    Thank you very much man! you save me, I was looking for this, I had to create a pdf with several invoices and I didn't know how. I can do it with your code.. Thanks again!
  • ara3nara3n Member Posts: 9,256
    You are welcome. :)
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • dfragosodfragoso Member Posts: 18
    Hi,

    How can i use the password mode of PDFCreator in Navision? I add this lines but the pdf file is not created...
    ...
    
    PDFCreatorOption.UseAutosave := 1; 
    PDFCreatorOption.UseAutosaveDirectory := 1; 
    PDFCreatorOption.AutosaveDirectory := FileDirectory; 
    PDFCreatorOption.AutosaveFormat := 0;                       //PDF file, you can also save in other formats 
    PDFCreatorOption.AutosaveFilename := FileName; 
    
    //TEST PASSWORD
    PDFCreatorOption.PDFUseSecurity :=1;
    PDFCreatorOption.PDFEncryptor := 1;
    PDFCreatorOption.PDFLowEncryption := 1;
    PDFCreatorOption.PDFUserPass := 1;
    PDFCreatorOption.PDFUserPasswordString := 'test';
    //TEST PASSWORD
    
    PDFCreator.cOptions := PDFCreatorOption; 
    PDFCreator.cClearCache(); 
    DefaultPrinter := PDFCreator.cDefaultPrinter; 
    PDFCreator.cDefaultPrinter := 'PDFCreator'; 
    PDFCreator.cPrinterStop := FALSE; 
    
    REPORT.RUNMODAL(ReportID,FALSE,TRUE); 
    
  • ara3nara3n Member Posts: 9,256
    Change the code to something like this.
    //TEST PASSWORD
    PDFCreatorOption.PDFUseSecurity :=1;
    PDFCreatorOption.PDFOwnerPass := 1;
    PDFCreatorOption.PDFOwnerPasswordString := 'MasterPass';
    
    PDFCreatorOption.PDFDisallowCopy := 1;
    PDFCreatorOption.PDFDisallowModifyContents := 1;
    PDFCreatorOption.PDFDisallowPrinting := 1;
    
    PDFCreatorOption.PDFUserPass := 1;
    PDFCreatorOption.PDFUserPasswordString := 'UserPass';
    
    PDFCreatorOption.PDFHighEncryption := 1;
    //TEST PASSWORD 
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • dfragosodfragoso Member Posts: 18
    Tks for the help, the code works perfect.
  • ara3nara3n Member Posts: 9,256
    dfragoso wrote:
    Tks for the help, the code works perfect.

    You are welcome.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • NizarzNizarz Member Posts: 12
    Hi,
    i'm trying to run this example, but when i imported the object and tried to compil it, i got this error : " you can't write "Item list" in ReportNo. and the cursor was leaded to the code which is in the "OnOpenForm" Part ...
    can u help please ? ](*,)
  • SavatageSavatage Member Posts: 7,142
    you don't have an "Item List" Report? PIck a different report to test.
  • ara3nara3n Member Posts: 9,256
    Nizarz wrote:
    Hi,
    i'm trying to run this example, but when i imported the object and tried to compil it, i got this error : " you can't write "Item list" in ReportNo. and the cursor was leaded to the code which is in the "OnOpenForm" Part ...
    can u help please ? ](*,)

    change this line

    ReportID := REPORT::"Item List";
    to
    ReportID := REPORT::"Customer - Labels";

    or to another report you want to print.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • David_SingletonDavid_Singleton Member Posts: 5,479
    I would like to vote this as

    "Most useful thread ever on MiBuSo"


    Thanks Rashed, I know its simple and I know anyone could do it, but YOU DID IT, thanks for sharing this, I am sure that collectively you have saved the community hundreds of hours messing about to solve all these silly issues.

    You should save it as a Download some how (even just as a text file of the source) so that we can vote for it. I am sure it would win the next "Best Down Load" Competition.


    It also serves as a great example of how something so simple can be so useful in NAV, a great lesson for all the newbies out there.

    =D>
    David Singleton
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Oh an d the reason I was actually here....


    Has anyone else come across the error where PDF objects created in ver. 0.9.3 won't run on 0.9.5 and vica versa. Basically the comand below will only run on a coumputer running the same version of PDFCreator that it ws complied with.

    The issue is the command
    PDFCreatorOption :=  PDFCreator.cOptions;
    

    Which gives the message:
    This message is fo C/AL programmers:
    Invalid assignment. It is not possible to assign a _clsPDFCreatorOptions to a clsPDFCreatorOptions.

    Its clearly an issue with wich dll you have registered, and I am pretty sure its a PDF creator issue, not a NAV issue.

    Its damn anoying having to use a different computer to compile objects to get this to work, and worst is when a client has computers with differnt version of PDF creator installed.

    Has anyone solved this?
    David Singleton
  • WaldoWaldo Member Posts: 3,412
    Anyone knows if PDFCreator works on Vista already?
    Can't find it in the forums ...

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Waldo wrote:
    Anyone knows if PDFCreator works on Vista already?
    Can't find it in the forums ...


    ?? ?Vista??? Whats that? =;
    David Singleton
  • WaldoWaldo Member Posts: 3,412
    Actually, I don't know. But i googled it, and found this. :mrgreen:

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • NizarzNizarz Member Posts: 12
    Hi all,
    i'm using already cute pdf for editing my reports in PDF format, but i want to send them in this format via Navision ... anyone can help please ](*,) ... Thnaks
  • ara3nara3n Member Posts: 9,256
    Nizarz wrote:
    Hi all,
    i'm using already cute pdf for editing my reports in PDF format, but i want to send them in this format via Navision ... anyone can help please ](*,) ... Thnaks

    If you are editing your documents in Cute pdf, navision can't open the pdf document.

    You need to modify or create a Navision report that you can the print to PDF.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.