[ SOLVED ] Print TVirtualStringTree to pdf lazarus / 21-General ---------------------------------------------------------------------- superc · 2021-08-03 09:29 Hello, I've created my TVirtualString and I must print the tree on pdf (and save it to file), how would you proceed? What components or methodologies would you use? Thanks in advance. ---------------------------------------------------------------------- balazsszekely · 2021-08-03 13:04 Quote from: superc on August 03, 2021, 11:29:01 amHello, I've created my TVirtualString and I must print the tree on pdf (and save it to file), how would you proceed? What components or methodologies would you use? Thanks in advance. This is a tough one. You can certainly save/load a VST to/from a file, but that's a binary format. In order to print a tree to a pdf, first you have to draw the tree canvas to a bmp, then via LazReport and PDFExport(alternatively FPReport/fcl-pdf) to a pdf file. Maybe there are other methods too that I'm unaware of. ---------------------------------------------------------------------- lucamar · 2021-08-03 14:13 Quote from: GetMem on August 03, 2021, 03:04:50 pmMaybe there are other methods too that I'm unaware of. Using fcl-pdf (or PowerPDF) would probably be the easier, wouldn't it? Or maybe relying on a PDF "printer" ... though that would force users to install one. ---------------------------------------------------------------------- balazsszekely · 2021-08-03 16:58 My brain hurts, but I did it.  I'm using the same project from your previous thread(https://forum.laz arus.freepascal.org/index.php/topic,55461.msg412695.html#msg412695). Lazarus 2.0.12(32 bit)/FPC 3.2.0/Zeos 7.2.14.0/Power PDF 1.4.0.0 Please do the following:    1. Extract attachment    2. Copy sqlite3.dll(32 bit) to the project folder    3. Install Zeos from OPM    4. Install PowerPDF from OPM    5. Go to "Install/Uninstall Packages" dialog, install Lazreport and LazreportPDFExport, don't forget to rebuild the IDE    6. Open then run the project, press the "Tree to PDF" button PS: The above method should also print the non-visible part of the tree(in case you have horizontal/vertical scrollbars). ---------------------------------------------------------------------- superc · 2021-08-04 07:13 Quote from: GetMem on August 03, 2021, 06:58:11 pmMy brain hurts, but I did it.  I'm using the same project from your previous thread(https://forum.laz arus.freepascal.org/index.php/topic,55461.msg412695.html#msg412695). Lazarus 2.0.12(32 bit)/FPC 3.2.0/Zeos 7.2.14.0/Power PDF 1.4.0.0 Please do the following:    1. Extract attachment    2. Copy sqlite3.dll(32 bit) to the project folder    3. Install Zeos from OPM    4. Install PowerPDF from OPM    5. Go to "Install/Uninstall Packages" dialog, install Lazreport and LazreportPDFExport, don't forget to rebuild the IDE    6. Open then run the project, press the "Tree to PDF" button PS: The above method should also print the non-visible part of the tree(in case you have horizontal/vertical scrollbars). it seems to me a fitting solution to my problem, now let's see how it behaves with 1000 node.... Thank you again ---------------------------------------------------------------------- balazsszekely · 2021-08-04 11:22 Unfortunately Lazreport does not increase the size of the image properly, so for a very large tree the generated pdf is wrong. You can try other report generating tools like:   - FPReport  - Fortes4Lazarus  - FortesReport-CE  - Fastreport All of the above has PDF export built in. I ran a few test for large trees, in each case the generated Bmp(see FBitmap in the code) is correct, however the bitmap size is very large. In my opinion the tree to pdf conversion is not practical. You should filter the tree or use some kind of pagination and only export the relevant data or perhaps switch to a formated text file?