SAVEASPDF not working

Jatin_PatelJatin_Patel Member Posts: 200
Hi,

i am generating report PDF using web services in NAV classic client.

i am able to generate pdf for other reports but i am not getting PDF for report no. 116 customer statement.

when i am using RUNMODAL it's working but with web services and SAVEASPDF not generating PDF file.

Is there any problem with report no. 116?

Thanks,
Jatin Patel
Microsoft Dynamics NAV Consultant
Jatin's Blog

Answers

  • afarrafarr Member Posts: 287
    Are you working in the Indian version? (I've never used that myself, I'm just asking.)

    Is report 116 customised? Do you have a copy of the report without the last customisation?


    RUNMODAL in the Classic client will run the Classic report, while webservices run the RDL report.
    Can you connect to the database in RTC and try to run the Statement?
    This will also run the RDL, and it may give an error message which could indicate what the problem is.

    You could also keep a copy of the report (just in case), then design it, go to "View - Layout", make some small change, and save. Again, this might produce some useful error messages, or it might even solve the problem.
    Alastair Farrugia
  • Jatin_PatelJatin_Patel Member Posts: 200
    Thanks Alastair

    Report is Customized. I check it with base report copy but problem still alive.

    In RTC report is running properly and giving proper output.
    Jatin Patel
    Microsoft Dynamics NAV Consultant
    Jatin's Blog
  • Alex_ChowAlex_Chow Member Posts: 5,063
    SAVEASPDF only works for RDLC formatted report. You might want to check if your customized report had the RDLC format removed. This is assuming you're using version 6.0.
  • afarrafarr Member Posts: 287
    Alex is right. I had said that the RTC will display the RDLC report, but if there is no RDLC, then the RTC will just run the classic report (which may be why it seems fine).

    When you run the report, do you see a request form, rather than a request page?
    Alastair Farrugia
  • Jatin_PatelJatin_Patel Member Posts: 200
    RDLC layout of report is ok and running fine on RTC client.

    When i run it from RTC then it will give me Request Page.

    In my code i use

    Statement.USEREQUESTFORM := FALSE;
    Jatin Patel
    Microsoft Dynamics NAV Consultant
    Jatin's Blog
  • Jatin_PatelJatin_Patel Member Posts: 200
    I write SAVEASPDF code in Page for testing. It is working fine and pdf is generated.

    But when i use same code in classic and calling from webservices it will not generate pdf for report no. 116 Customer Statement.
    Jatin Patel
    Microsoft Dynamics NAV Consultant
    Jatin's Blog
  • MarijnMarijn Member Posts: 69
    You cannot use RUNMODAL statments when using webservices. That will cause a callback error. So I think that's your problem.
  • davmac1davmac1 Member Posts: 1,283
    In Classic, it is best to use the tried and proven method in Rashed's (ara3n) print to pdf entry on Mibuso. I have used it many times with Bullzip as the pdf writer.
    I believe it is the most popular tip ever made in Mibuso, so worth your while to check it out.
  • icobaniicobani Member Posts: 70
    I recommended biopdf
    http://www.biopdf.com/

    you can find sample.
    "Company Information".GET();
    RootReportDir:="Company Information"."Web Pdf Folder";
    
    IF ISCLEAR(autBullzip) THEN BEGIN
      CREATE(autBullzip);
    END;
    
    autBullzip.Init;
    autBullzip.LoadSettings;
    txtRunOnceFile := autBullzip.GetSettingsFileName(TRUE);
    
    IF ISCLEAR(Fso) THEN
    CREATE(Fso);
    
    IF NOT Fso.FolderExists(RootReportDir + SalesInvoiceHeader."Sell-to Customer No." + '\') THEN BEGIN
      Fso.CreateFolder(RootReportDir + SalesInvoiceHeader."Sell-to Customer No." + '\');
    END;
    
    ptxtPDFFileName :=RootReportDir + SalesInvoiceHeader."Sell-to Customer No." + '\SalesInvoice.'+ SalesInvoiceHeader."No."  + '.pdf';
    IF Fso.FileExists(ptxtPDFFileName) THEN BEGIN
      Fso.DeleteFile(ptxtPDFFileName);
      SLEEP(500);
    END;
    
    autBullzip.SetValue('Output',ptxtPDFFileName);
    autBullzip.SetValue('Showsettings', 'never');
    autBullzip.SetValue('ShowPDF', 'no');
    autBullzip.SetValue('ShowProgress', 'no');
    autBullzip.SetValue('ShowProgressFinished', 'no');
    autBullzip.SetValue('SuppressErrors', 'yes');
    autBullzip.SetValue('ConfirmOverwrite', 'no');
    
    autBullzip.SetValue('WatermarkText', FORMAT(WatermarkText));
    autBullzip.SetValue('WatermarkVerticalPosition', 'top');
    autBullzip.SetValue('WatermarkHorizontalPosition', 'left');
    autBullzip.SetValue('WatermarkVerticalAdjustment', '3');
    autBullzip.SetValue('WatermarkHorizontalAdjustment', '1');
    autBullzip.SetValue('WatermarkRotation', '90');
    autBullzip.SetValue('WatermarkColor', '#DFDFDF');
    autBullzip.SetValue('WatermarkOutlineWidth', '1');
    
    autBullzip.WriteSettings(TRUE); 
    
    
    
    SalesInvoiceHeader.SETRANGE(SalesInvoiceHeader."No.",SalesInvoiceHeader."No.");
    SalesInvoiceHeader.SETRANGE(SalesInvoiceHeader."Sell-to Customer No.",SalesInvoiceHeader."Sell-to Customer No.");
    IF SalesInvoiceHeader.FINDFIRST THEN BEGIN
      SalesInoviceReport.SETTABLEVIEW(SalesInvoiceHeader);
      SalesInoviceReport.USEREQUESTFORM:=FALSE;
      SalesInoviceReport.RUN();
    END;
    
    REPEAT
      SLEEP(100);
    UNTIL NOT Fso.FileExists(ptxtPDFFileName);
    SLEEP(2000);
    
    CLEAR(WshShell);
    CLEAR(autBullzip);
    CLEAR(Fso);
    EXIT(ptxtPDFFileName);
    
    Ibrahim COBANI | Dynamics-NAV Developer Team Manager
    I m a Consult

    E-Mail: ibrahim@imaconsult.com
    My BLOG
Sign In or Register to comment.