Lazarus

Programming => Packages and Libraries => LazReport => Topic started by: mirce.vladimirov on October 17, 2014, 11:37:00 pm

Title: trick to enable Lazreport to PDF and cyrilic
Post by: mirce.vladimirov on October 17, 2014, 11:37:00 pm
 :D   :D   :D   :D
I am very happy now, thats why are these smiles for.
This is helpful to all Lazarus programers that create reports with non-latin character set, like cyrilics, Chinese, Greek, Arabic... LazreportToPDF doesnt support these charsets, displays "????" instead of letters, so we had to improvise. I believe you will like this improvisation as much as I liked it.

Very often we need to convert large number of Lazreports to PDF and so far my application was not able to do that dynamicaly, instead I was using the PDF Creator for that. But it is realy boring  repeating all the "click  Save", "select folder", "save as" etc etc... sometimes my clients had to export 10-15 documents in a row, which was realy pain in the ass.
But tonight i've just found out the PDFCreator's feature to have diferent profiles plus setting a default profile !!
Do this :
1.Start the PDFCreator
2.Under "Printer" click "Options"
3.A separate form will be opened, click the "+" like in the attached named "pdf2.png" attached to this post
4.New profile will be created, you can change its name according to your favour.
5.Now set the "auto-save" options like in the attached "pdf3.png"
5.Then close that form and return to the main form, click "printer" and selec "printers", a new form will open which looks like the attached "pdf4.png", here you can change your favourite profile to be used as default one.
And thats it. Now in my application if user selects the printer named "PDFCreator" a Lazreport is converted to PDF silently and it's located in the predefined folder. When printing reports continously into separate PDF Files i do (assuming that on clients computer the PDFCreator was installed) :
Code: [Select]
  i:=0;
  for i:=0 to printer.Printers.Count-1 do begin
     if pos('PDFCreator', printer.printers[i] )>0 then begin
         printer.PrinterIndex:=i;
         break;
     end;
  end;

  frReport1.Clear;
  frReport1.LoadFromFile('vopdf1.lrf');
  if frReport1.PrepareReport then begin
          frReport1.PrintPreparedReport('1-9999',1);
  end;
end;                                         

Now its easy to convert many reports to PDF docs one after another without bothering the client.
Title: Re: trick to enable Lazreport to PDF and cyrilic
Post by: jesusr on October 17, 2014, 11:54:56 pm
This is helpful to all Lazarus programers that create reports with non-latin character set, like cyrilics, Chinese, Greek, Arabic... LazreportToPDF doesnt support these charsets, displays "????" instead of letters, so we had to improvise. I believe you will like this improvisation as much as I liked it.
....

Now its easy to convert many reports to PDF docs one after another without bothering the client.


LazReport support all that if you use the Cairo PDF exporter, instead of the PowerPDF exporter.
Title: Re: trick to enable Lazreport to PDF and cyrilic
Post by: mirce.vladimirov on October 18, 2014, 12:06:08 am
LazReport support all that if you use the Cairo PDF exporter, instead of the PowerPDF exporter.

Then Post the link please, I've killed myself improvising. Is it well documented ?
Title: Re: trick to enable Lazreport to PDF and cyrilic
Post by: jesusr on October 18, 2014, 12:27:18 am
As much as PowerPDF exporter :).

You can find Cairo LazReport Exporter in menu Packages->Install/Uninstall Packages then install package lrCairoExport, once installed in LazReport tab you should see a Cairo exporter Icon, just drop it in your LazReport form and it should be available.
TinyPortal © 2005-2018