Hi
I have below code and i want File should get automatically get created in c:\Drive of User. It should not ask user to save file.
SAPbobsCOM.CompanyService oCmpSrv;
SAPbobsCOM.ReportLayoutsService oReportLayoutService;
SAPbobsCOM.ReportLayoutPrintParams oPrintParam;
oCmpSrv = oCompany.GetCompanyService();
oReportLayoutService = (ReportLayoutsService)oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.ReportLayoutsService);
oPrintParam = (ReportLayoutPrintParams)oReportLayoutService.GetDataInterface(SAPbobsCOM.ReportLayoutsServiceDataInterfaces.rlsdiReportLayoutPrintParams);
oPrintParam.LayoutCode = "PM10014";
oPrintParam.DocEntry = 555;
oReportLayoutService.Print(oPrintParam);
Thanks
Sandhiya PriyaPosted Aug 12, 2025, 10:55 AM
Answer: How to Save File in PDF Format in ASP.NET C#
In ASP.NET (C#), you can save or generate PDF files using libraries like iTextSharp, PDFSharp, or Syncfusion.
One of the most commonly used free libraries is iTextSharp.
1. Install iTextSharp
If using NuGet Package Manager:
2. Example: Create and Save a PDF
3. Saving PDF Directly to Browser (Download)
If you want the user to download it instead of saving on the server:
Notes:
Always ensure you have write permissions on the folder if saving on the server.
For complex designs, use tables, images, and styles available in iTextSharp.
If working in .NET Core, use iText7 or QuestPDF instead.
Muhammad Imran AnsariPosted Feb 14, 2025, 10:50 AM
Hello Ramco,
To automatically save the file to a specific location (e.g.,
C:\Drive) without prompting the user, you need to modify your code to specify the output file path and ensure the file is saved directly to the desired location. Unfortunately, thePrintmethod in theReportLayoutsServicedoes not directly support saving to a file without user interaction. However, you can achieve this by using a workaround, such as printing to a PDF printer and saving the file programmatically.Below is an example of how you can achieve this using a PDF printer (e.g., Microsoft Print to PDF or a third-party PDF printer):
Good Luck!
Ajesh DalviPosted Feb 13, 2025, 8:35 AM
Ramco RamcoPosted Feb 12, 2025, 8:16 AM
Hi Amit
It is giving Error - ReportLayoutExportParams does not exist in namespace SAPbobsCOM
Thanks
Amit MohantyPosted Feb 12, 2025, 8:05 AM
Check this: