#1 2014-06-25 13:43:18

Celery
Member
Registered: 2014-02-10
Posts: 5

Using different printer driver ?

Hi!

I use TGDIPages to create a report and then export it to a PDF-file.

I noticed that papersize and font depends on default printer in Windows. Papersize I found that I could change by calling NewPageLayout(psa4), but I don't know how to affect the font used ? Maybe it's not the font, but "font-scaling" that's the problem. Anyway, the text looks different, and don't appear at the same place, if the default driver is "Generic/Text Only" compared to when another driver is chosen.
I thought I could set the property PrinterName to a desired printer, but realized it was a readonly property. I guess there's a reason for it ?

Which is the best way to solve this ?

Best regards.

Offline

#2 2014-06-25 20:04:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Using different printer driver ?

I guess you can change Printers.Printer.PrinterIndex before creating the report to change the reference printer.

Or just try to set ForceScreenResolution property to true.

Offline

#3 2014-06-26 13:56:40

Celery
Member
Registered: 2014-02-10
Posts: 5

Re: Using different printer driver ?

Thanks you! Setting Printers.Printer.PrinterIndex helps. smile
When having ForceScreenResolution to true it didn't look good.

I considered converting the application to use TPdfDocument or TPdfDocumentGDI instead of TGDIPages. Would they also require setting PrinterIndex ?

Offline

#4 2014-06-26 14:03:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Using different printer driver ?

TPdfDocument or TPdfDocumentGDI do not know anything about printers: they produce just some pdf using TPDFCanvas or TMetaFileCanvas methods.
AFAIK the only place when the printer is used is for complex matrix scaling (lometric/himetric/isotropic...) which should be seldom used.

The TPdfDocumentGDI is much to be preferred to TPdfDocument, since its VCLCanvas (to be used with VCLCanvasSize for coordinates computation) is a true VCL TCanvas, so you can share code with your UI.
But TGdiPages is much more convenient to write text reports with tables and pictures.

Offline

Board footer

Powered by FluxBB