You are not logged in.
Pages: 1
Hi,
I'm a newbie with the synPDF, so I hope this question is not too stupid.
I am developing a website that's output a pdf formula. The formula seems fine on my development computer, but when i place the program on our server the placement of text is changing. I would preciate some advice.
I am trying to print text in fx x=15 mm and y=40 mm, but it seems as a mm is longer on my server than on my development machine (missing the lower part of the printout, and also wider)
Here is what I am doing:
lPdf := TPdfDocumentGDI.Create;
lpdf.EmbeddedTTF:=true; // embed fonts as the user might not have these
lPdf.DefaultPaperSize := psA4;
lpdf.DefaultPageLandscape:=true;
lPdf.ScreenLogPixels:=96; // is the problem here ??
lPage := lPDF.AddPage;
lPdf.VCLCanvas.Brush.Style:=bsClear;
x_dot_mm := GetDeviceCaps(lPdf.VCLCanvas.Handle,HORZRES)/GetDeviceCaps(lPdf.VCLCanvas.Handle,HORZsize);
y_dot_mm := GetDeviceCaps(lPdf.VCLCanvas.Handle,vertres)/GetDeviceCaps(lPdf.VCLCanvas.Handle,vertsize);
xmm := round(x*x_dot_mm);
ymm := round(Y*y_dot_mm);
lpdf.vclCanvas.TextOut(xmm,ymm,tekst);
I would love to have the same printout from both PC's, how do i do that. (Please be specific as I am a newbie)
regards
Offline
I am developing a website that's output a pdf formula. The formula seems fine on my development computer, but when i place the program on our server the placement of text is changing. I would preciate some advice.
[...]
(missing the lower part of the printout, and also wider)
Maybe that is related to the problem I have, where the output is different (in the lower part of the page). Here, too, on development computer and in a desktop environment everything looks fine. On the Webserver the output is different.
Offline
I investigated my problem a little further and found out, that on the Webserver I can only print fewer lines on one page (related to totaldata's observation that a mm seems longer on his webserver).
Maybe it has todo with the fact that there's no printer or screen? Somewhere where the size of the Metafile is defined?
Last edited by Jumpy (2013-09-23 16:30:04)
Offline
Hi All,
New member wrote: Maybe it has todo with the fact that there's no printer or screen? Somewhere where the size of the Metafile is defined?
Just to check this, I installed a printer on the server, and ran the program with an open remote window, but with no changes. I still have some "long" mm. By the way, my faulty application is running on an old MS Small Business Server 2003
regards
Offline
I know this is very quick and extremely dirty, but for those of us who needs to solve the problem here and now, you must scale down the printout on the server. Of course the problem should be solved otherwise, but meanwhile:
I have to scale the x with approx 0.67 and y with approx 0.8 (done visual, but ok for me). It is rather simple to do this. you can figure out the OS with major and minor version in delphi and these are predefined in delphi (Win32MajorVersion, Win32MinorVersion):
major.minor = 5.2 => Windows 2003 server or XP64
major.minor = 6.0 => Windows Vista/2008 server
major.minor = 6.1 => Windows 7/2008 server R2
My code now looks like (only server 2003 implemented in the code, you must change the condition if running other server version):
lPdf := TPdfDocumentGDI.Create;
lpdf.EmbeddedTTF:=true; // embed font that the user might not have
lPdf.DefaultPaperSize := psA4;
lpdf.DefaultPageLandscape:=true;
lPdf.ScreenLogPixels:=96;
lPage := lPDF.AddPage;
lPdf.VCLCanvas.Brush.Style:=bsClear;
scalex:=1;
scaley:=1;
if (Win32MajorVersion=5) and (Win32MinorVersion=2) then begin
//•major.minor = 5.2 => Windows 2003 server or XP64
//•major.minor = 6.0 => Windows Vista/2008 server
//•major.minor = 6.1 => Windows 7/2008 server R2
scalex :=0.67;
scaley :=0.8;
end;
x_dot_mm := GetDeviceCaps(lPdf.VCLCanvas.Handle,HORZRES)/GetDeviceCaps(lPdf.VCLCanvas.Handle,HORZsize)*scalex;
y_dot_mm := GetDeviceCaps(lPdf.VCLCanvas.Handle,vertres)/GetDeviceCaps(lPdf.VCLCanvas.Handle,vertsize)*scaley;
regards
Offline
You might be right. I was in doubt about using DESKTOPHORZRES instead of horzres and DESKTOPVERTRES instead of vertres
microsoft documentation state:
DESKTOPHORZRES Windows NT only: Width, in pixels, of the virtual desktop. This value may be larger than HORZRES if the device supports a virtual desktop or multiple displays.
DESKTOPVERTRES Windows NT only: Height, in pixels, of the virtual desktop. This value may be larger than VERTRES if the device supports a virtual desktop or multiple displays.
I need to have a solution to this problem, as it is stalling a company startup of a new service, and I have the CEO breating down my neck, so I have to make a QAD solution.
Offline
Pages: 1