Generate PDF by code
Pietro Cannizzaro1307610977
Hi to all, I'm new in this forum and in coresuite designer as well.I would like to know the C# code I've to put into GenerateScript property in order to generate a PDF file while the report is rendering.
The PDF must be the same of the report.
It's very importanto to me that coresuite designer has this capability.
I'm using Coresuite add-on 2.32 (designer 1.648) on SAP B1 2005A SP01 PL43
Thank you in advance for your answer
Philipp Knecht
HiJust use in the Generatescript :
If Engine.IsDoublePass Then
LayoutOpener.OpenLayout(LayoutOpener.OpenLayoutModes.PDF,"139","DocEntry","1")
End If
Pelase have in mind that we can solve such problems in individual Workshops or with a Support Package which you can get from our Website http://www.coresuite.ch
(both remote or on site)
hth
Pietro Cannizzaro1307610977
Hi Philipp, thank you for your answer.I didn't explane what I want to do very well, I'm sorry.
I want to generate a PDF and save it automatically into a folder (e.g. "C:MyPdfFile.pdf")
I'm sorry,,
Thank you in advance
Philipp Knecht
Hi PietroIn this case just check the option "PDF" in the Printdefinition.
Define a path in the Email/Fax Tab of the Printdefinition.
Use the PDF Button of Business One (>PL29)
hth
Massimo Sommaruga
Hi Philip,last week Pietro took a base training on Coresuite Designer with me.
During the training he asked me how to generate a txt file and a pdf copy in a specific folder while printing a document.
We hadn't no problem to generate the txt file with the function
System.IO.File.WriteAllText but I wasn't able to explain to him how to generate the pdf file...
I know that the command LayoutOpener.OpenLayout(LayoutOpener.OpenLayoutModes.PDF...) opens a document as you click on the PDF Button on the SBO toolbar. (this is not the issue..) and that you can crate a PDF file in a specific path throught the printdefinition
But the question is: how can we create a PDF copy of the current document while we are printing? (without showing the PDF copy to the user?).
I've tried to do something using the command
PerpetuumSoft.Reporting.Export.Pdf.PdfExportFilter()
but i don't know how to pass to this function the current document...
Can you help us?
Thank you in advance.
Regards.
Philipp Knecht
Hi MassimoLook at my first post in this thread.
You have to put this LayoutOpener... - Code in the Generatescript in the Document.
This function always opens the requested document.
hth
Massimo Sommaruga
Hi Philipp,thank you, I understand what you mean and I was able to create the pdf copy.
However, I have new questions:
- can you set the "Open word/excel/PDF" property of the printdefinition in the generatescript (so that I open the pdf when I click the PDF button on the SBO toolbar but i don't open the pdf file when I press thr Print button and I create the pdf file throught the function I put in the generatescript)?
Thank you.
Massimo
Philipp Knecht
Hi MassimoNo this is not possible.
But just make another printdefinition were you only check PDF and uncheck "Open Export...".
Then also provide "PrintDef","U0000XY" in the Paramlist of the Layoutopener and it'll always use exactly this Printdef.
hth
Philipp Knecht
Hi MassimoYou can also set the statusn of this Printdefinition to inactive so it will not disturb you in the daily work. But it works when callled via OpenLayouter...
0
Please sign in to leave a comment.
Comments
0 comments