FwSavePreviewToPdf

Re: FwSavePreviewToPdf

Postby nageswaragunupudi » Sat May 12, 2018 9:28 am

Thanks.
Can you offer any advice or guidance to improve FWH's function PreviewToPDF in terms of reducing the pdf size without loss of quality?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FwSavePreviewToPdf

Postby Carlos Mora » Sat May 12, 2018 9:30 am

Here there is an interest tool, I run into it while searching EMF to PDF translation

https://wiki.lyx.org/uploads/Windows/metafile2eps/

There is source code available, so I think it could be used as a library.
EMF 2 EPS, then to PDF with GhostScript
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: FwSavePreviewToPdf

Postby AngelSalom » Sat May 12, 2018 9:34 am

Hola Carlos, uso libharu con excelentes resultados desde hace bastante tiempo para generar los impresos (facturas, albaranes, etc.). Mi inquietud viene en lo que respecta a tReport.

Tengo un sistema de reportes muy complejo y dependiente de esa clase, por eso estaba planteándome buscar alguna solución para exportar desde el preview (solo los reportes) antes de meterme en el "fregado" de hacer una subclase de tReport para generar los PDFs. Similar a lo que tiene ahora dicha clase para exportar a Excel con el método ToExcel() que reinterpreta el informe.

Lo que está claro es que necesitamos una herramienta que haga este trabajo cada vez más solicitado, la función que provee fw es inutilizable, hoy en día no concibo un PDF en el que el informe sea un conjunto de imágenes.

Con lo que comentas de image2pdf de los fuentes, queda descartado

Gracias

Carlos Mora wrote:Regards Image2Pdf, it did a good job, but when used to transform META to get real (not image) pdf, i had _many_ issues related to font translation. Usually the problems came from the fact that font names are different in Spanish than English, so the library wasn't able to make the right font translation. By that time I worked with the author of the library, but we weren't able to find a solution for the issue.

I also used PdfCreator, who gave me one of the best results in terms of quality. It really produces very small pdfs, and you are able to select and copy text from them. The only issue I had was that managing the printJob queue is time/resource consuming, and eventually having more than one program producing pdf documents can be really difficult to manage. To produce masive pdfs like in payroll printing, it didn't make.

When pdf size and quality matters, there is nothing like use a library that write real pdf documents, like Haru. Realy fast, lightweight, and the best results you can get. You may take a look at the following library, Mastintin and I were working on it some months ago. It will give you a good starting point to help in the convestion of current FW printing code.

https://bitbucket.org/carlos_mora/pdfprinter/
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 727
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: FwSavePreviewToPdf

Postby Carlos Mora » Sat May 12, 2018 9:43 am

nageswaragunupudi wrote:Can you offer any advice or guidance to improve FWH's function PreviewToPDF in terms of reducing the pdf size without loss of quality?

Only God knows how long I've been fighting with that :)
I never found sth that could make it, for preview the closest was Image2Pdf.dll using Native Metafile, but it didn't worked 100%. I know the source code is available for sale, but I'm not sure if it deserves the effort.
Another way may be to search a way to handle MS virtual printer, that probably will make a very good translation, never tried.

PdfCreator uses a virtual PCL printer + GhostScript, we can change the virtual PCL with 'matafile2eps' program.
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: FwSavePreviewToPdf

Postby Carlos Mora » Sat May 12, 2018 10:02 am

Hola Angel,
(Viene movido el sábado) :)
AngelSalom wrote:Mi inquietud viene en lo que respecta a tReport.
Tengo un sistema de reportes muy complejo y dependiente de esa clase, por eso estaba planteándome buscar alguna solución para exportar desde el preview (solo los reportes) antes de meterme en el "fregado" de hacer una subclase de tReport para generar los PDFs. Similar a lo que tiene ahora dicha clase para exportar a Excel con el método ToExcel() que reinterpreta el informe.

I understand your concern, I it was mine too, but not as important. When i wrote the PdfPrinter I thought in TReport too, but I found TReport makes many of its decisions based on the physical printers properties, querying the operating system functions directly, so there is no way to cheat it with sth like that.
If I had to make a change, I would go for abstracting the device in TReport (like TCanvas in Delphi), pulling apart rendering issues from the logic and be centered in only one concern. In this way then we will be able to create new pseudodevices (like XLSX writers, html, pdf, etc) to handle the output.
I'm not a big fan of having big classes that make many things, hate the monsters with many heads :) It turns things in 'look but don't touch'.

KR!
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
 
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests