CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Save PDF file in Server Folder from base64

Questions & Answers about IWCGJQuery Suite.

by mfernandez92 » 14 Mar 2016 21:58

Hi CGDevTools Team!

I have a html form inside a TIWCGHTMLSnippet component.
The form submition result in a pdf report encoded as base64, generated with this js library: PDFMake (http://pdfmake.org/#/)

I'm using this js function to generate the pdf:
Code: Select all
function save_pdf(doc) {
pdfMake.createPdf(doc).getBase64(function(base64String) {
                parent.executeAjaxEvent("&base64=" + base64String, null, "savePDF", false, null, true);
   });
}


The callback "savePDF" expects the base64 pdf data to decode it and save the pdf binary file.

But the callback produce this error: "Exception class EIdReadLnMaxLineLengthExceeded with message 'Max line length exceeded.' ".
This error occurs because the base64String argument of the callback is too large.

How can I pass this large data to the server (I'm using Delphi XE5) and save the pdf file in a server folder?.
mfernandez92
 
Posts: 3
Joined: 24 Nov 2015 19:26

by Alexander Bulei » 15 Mar 2016 15:12

Hi mfernandez92,

This error occurs because the base64String argument of the callback is too large.


Yes, the url have size limit...
You need send the data (base64) in body of request, but unfortunately, the IW doesn't have this possibility...
We will analyze this situation and maybe, create the component which will provide this feature.
Thanks.

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by Jorge Sousa » 22 Mar 2016 10:49

Hello

You can also set the following in ServerController.Initialization:

Code: Select all
implementation

uses
  InIOHandler;

{....}

initialization
{....}
InIOHandler.IdMaxLineLengthDefault:= 48 * 1024; // or more, the default is 32*1024
end.




viewtopic.php?f=20&t=2744&p=13805#p13805
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by hsbelli72 » 24 Mar 2016 14:46

hi, is possible add this component (pdfMake) to the suite?.. is a great option for print a pdf file..

regards
hsbelli72
 
Posts: 297
Joined: 14 Mar 2013 18:10

by scoluccia » 24 Mar 2016 23:29

also for me it is a great option to create a pdf files.
Can I ask to mfernandez92 if he posts an example how can we use in this suite for example to print a form and if he can write an opinion about this library
Thanks
scoluccia
 
Posts: 61
Joined: 11 Mar 2015 15:10

by mfernandez92 » 20 May 2016 14:30

scoluccia to make a form with PDFMake, first I divide the document in sections (using a stack of columns) and then per page I have a max of 2 columns of fields (panels).
For each field, I using two columns, one for the label and other for the value.
To render the document in CGDevTools, I using a HTML Snippet component.
PDFMake is a good tool when you have a standard format of the document. When you have to make custom documents from a set of options (for example, using an abstract factory), its going heavy.
mfernandez92
 
Posts: 3
Joined: 24 Nov 2015 19:26


Return to Q & A

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.