Hello,
as from the title:
since the C# Model Generator builds the POCO but also stores the .srd file (i.e. the entire DW layout) would it be possible to enhance the C# datastore API and add PDF generation (even in memory) ?
Something like the NativePDF in regular PB dw.SaveAs().
That would allow to generate the PDF server side, and return it to the client (Base64 encoded?).
Any advise?
Best,
.m
I am interested to see how you can build PDF files without DW GUI controls like: Picture, Line, Oval, Rectangle, border, font, style colouring, etc. PDF's really need visual objects in order to render anything useful IMHO.
Over the weekend, I was able to build a simple C# Web API that called PB batch app EXE's using the following test code ....
System.Diagnostics.Process lo_process= new System.Diagnostics.Process();
lo_process.StartInfo.FileName = @"C:\Dev\PB2017\PDF\PBPDF.exe";
lo_process.StartInfo.Arguments = "C:\Inetpub\PDF\TEST.pdf"; //argument
lo_process.StartInfo.UseShellExecute = false;
lo_process.StartInfo.RedirectStandardOutput = true;
lo_process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
lo_process.StartInfo.CreateNoWindow = true; //not diplay a windows
lo_process.Start();
string output = lo_process.StandardOutput.ReadToEnd(); //The output result
lo_process.WaitForExit();
I was able to simulate up to 50 concurrent threads. The response time was about 1-3 seconds. The batch PB App EXE was written using my framework, so I was able to bind each new thread to a specific CPU using the framework's "CPU Affinity" feature. Not 100% perfect but this does allow for some multi-threading from the O/S side.
As far as the Web Server landing platform or using a DB Table ... I use this approach when standard daily, weekly, monthly, quarterly, etc reports are produced by a system. Instead of generating these for every client call, I save them and just resend them to each client from the "pool" of PDF's already built. Then the Web Service turn-around then is in milliseconds.
Any way, just a food for thought of how one *could* build SnapDevelop C# Web API web services PDF generation today ... while we wait for Armeen to code the SRD support. ;-)
HTH ... Food for thought
Regards ... Chris
very appreciated your WebAPI2EXE test case and benchmark. That is certainly a workaround that deserves to be proposed to impatient customers instead of parking promising C# REST projects waiting for a builtin feature. Thank you!
W.r.t to rendering graphical controls in the PDF, I mean the .srd file already contains the geometry of these controls. Years ago I used to create my own PDFs from PB using Java and iText: you open a FileOutputStream, create an empty document and then start scripting what objects your're gonna display: paragraphs, images, ovals... play with absolute or relative coordinates on the page, etc ...this is how PDF is actually created and how graphical controls are assembled together.
Best,
.m